Hi all , we have our AEM project home page as smarter and underneath smarter.html we create all other website pages. Now using Apache .htaccess file using rewrite rules we need to remove /content/smarter from all the page URLs . For example if the default page url is smarter.com/content/smarter/article1.html should be displayed on browser as www.smarter.com/article1.html. Please any help with the rewrite rule or 301 redirect method in Apache will greatly helpful and appreciated. Thanks in advance
Solved! Go to Solution.
You can handle it in AEM itself, simply create a sling mapping node under etc/host and you should be able to achieve all shortening of URL.
dev.day itself have an example to remove /content/ from the link path using sling mapping, kindly refer to following link - http://docs.adobe.com/docs/en/cq/5-6-1/deploying/resource_mapping.html#Creating%20Mapping%20Definiti...
They have mentioned example to truncate /content/ from the links, you can further extend the mapping to truncate your desired pattern from the URL.
Once you have the mapping configuration in place then AEM takes care of all the links and automatically shortens the URL that is rendered on them.
- Hope it helps
Runal
You can also use vanity URL in AEM itself https://helpx.adobe.com/experience-manager/kb/vanity-urls.html
or you can configure the global redirect in apache http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Views
Replies
Total Likes
You can handle it in AEM itself, simply create a sling mapping node under etc/host and you should be able to achieve all shortening of URL.
dev.day itself have an example to remove /content/ from the link path using sling mapping, kindly refer to following link - http://docs.adobe.com/docs/en/cq/5-6-1/deploying/resource_mapping.html#Creating%20Mapping%20Definiti...
They have mentioned example to truncate /content/ from the links, you can further extend the mapping to truncate your desired pattern from the URL.
Once you have the mapping configuration in place then AEM takes care of all the links and automatically shortens the URL that is rendered on them.
- Hope it helps
Runal
Following snippet should rewrite short links without redirection. It also requires "DispatcherUseProcessedURL 1" directive set in the Dispatcher config
# opt-out proper URLs from rewriting RewriteRule ^/(apps|bin|etc|home|libs|tmp|var|content|dispatcher)/ - [L,NC] # rewrite everything else RewriteRule ^/(.+) /content/smarter/$1 [QSA,PT]
Views
Replies
Total Likes
Can anybody get the exact rewriterule and correct steps where and all I need to make changes please.
I need to write the Rewrite Rule in .htaccess file in Apache webserver.
What changes I need to make exactly in dispatcher and where in dispatcher like dispatcher.conf or dispatcher.any file
Any help in this regard is really helpfull
Views
Replies
Total Likes
Hi ,
I modified the dispatcher.conf file with 1
also i updated our .htaccess file with below code you sent
But still /content/smarter gets appended for any pages i open.
Any help in this regards will be really helpfull.
Thanks
Views
Replies
Total Likes
RTFM...
Apache mod_rewrite: http://httpd.apache.org/docs/current/rewrite/
AEM Dispatcher: https://docs.adobe.com/docs/en/dispatcher.html
Views
Replies
Total Likes
You're doing two different things. mod_rewrite rewrites the http request. It doesn't touch the content of the page. If you don't change how you write out a URL then it will write out the full path. Yes, AEM will truncate the paths for you for the majority of the URLs but you'll need to configure AEM to do that in either the Resource Resolver OSGi config or in /etc/map. I'd recommend the link Runal put in his comment
Views
Replies
Total Likes
Snap of Configuration:
[img]resourceresolver_mapping.jpg[/img]
This works as long as you are shortening the URL for one site. If you put the same rule for geometrixx-media as well and try to access localhost:4502/en.html it will still you to /content/geometrixx/en.html the 1st rule takes precedence but still geometrixx-media page will keep shortening the URL's.
So when you have multiple sites in repository for which you want to apply url shortening and expansion then I would suggest to for etc/map approach in case of single site URL shortening stick to resource resolver approach.
Hope it helps now.
- Runal
Awesome dude, it works
Views
Replies
Total Likes
Hi Runal,
Can you please share the screenshot of the configuration again.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies