Hi,
We have a requirement to redirect detail/article pages from one location to another location for the scenario of old article bookmarks.
Old article path : /content/project/us/en/category1/articleslist/article1.html
new article path : /content/project/us/en/category2/folder1/articleslist/article1.html
The below redirect rule works in local aem dispatcher on windows machine (apache 2.2 windows 64 bit). However, the same rule does not work in aem as a cloud service dev environment.
RewriteRule ^/content/project/us/en/category1/articleslist/(.*)$ /content/project/us/en/category2/folder1/articleslist/$1 [PT,L]
One difference i could observe is that in my local aem instance, I don't have shortened url paths rules to facilitate article paths http://domain/us-en/category1/articleslist/article1
should the above rewrite rule be written with * and to remove /content/project/us/en in order to work on higher environments on aemaacs ? Any pointers on this would be of great help.
Thanks,
S
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Perhaps, you have rewrite rules above your rule that match first. This can be a potential issue.
You can try the following rule:
RewriteRule ^(/content/project/us/en)?/category1/articleslist/(.*)$ $1/category2/folder1/articleslist/$2 [PT,L]
I don't know how do you map us-en to /us/en, but you can adapt rule based on the rewrite logic for locale.
By the way, if you need to redirect old locations (bookmarks) to new location, you need to use 301 redirect:
RewriteRule ^/([a-z\-]+)/category1/articleslist/(.*)$ $1/category2/folder1/articleslist/$2 [L,R=301]
Hi @SrinivasanPa1 ,
You are right, if on higher org url is shortened, below rewrite rules should work
RewriteRule ^/us/en/category1/articleslist/(.*)$ /us/en/category2/folder1/articleslist/$1 [PT]
Also with above rules it will not change the path at client side(i.e. in browser it will remail /us/en/category1/articleslist/(.*))
if you want to show redirect at at client side to the user you may write below rules
RewriteRule ^/us/en/category1/articleslist/(.*)$ /us/en/category2/folder1/articleslist/$1 [R=301,L]
Just for cross checking make sure to put these rewrite rules in starting specially before below (similar) rewrite rule ( where shortened path is getting mapped to content path)
RewriteRule ^/(.*)$ /content/${CONTENT_FOLDER_NAME}/$1 [PT,L]
In local also shortened url should work if etc mapping or resource resolver config (whatever present in dev) is available in local.
You may try hitting http://localhost:4502/us-en/category1/articleslist/article1
Thanks
Views
Likes
Replies