Hi Team,
Need quick resolution for this - href="/" should take me to the home page, but it redirects to the same page.
Any help in dispatcher rewrite rules or anything?
I don't want to give the complete path. I only want to use "/".
Thanks!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Yes @ArindamPatra15
You can achieve this using rewrite rules in dispatcher
Below is the rules to redirect "/" to respective home page based on country code http header.
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^(projectname)(.*)\.com$
RewriteCond %{HTTP:X-country-code} (us)
RewriteRule ^/ https://%{HTTP_HOST}/us/en.html
Consider you have multiple locales in your project, then you would need to write each rules as such for each locale.
If you have just one home page , you can directly use ,
RewriteRule ^/ https://%{HTTP_HOST}/us/en.html
Hi @pulkitvashisth Thanks for your help.
Is there any way we can write only once and it handles for all locales?
We have multiple locales, cant we write a rule, which handles for all locales?
Thanks!
Hi @pulkitvashisth , This issue is in my local too. Do you think, its a dispatcher issue?
If you want "/" to land on the respective locale home page path, then you would need to write rewrite rule for all the locales.
If you want the user to land on a global locale page for "/" regardless of locale.
Then just one rule should do the job.
In the AEM archetype, you can find the rule: https://github.com/adobe/aem-project-archetype/blob/ab4979897c0d43d4f37f6c96781db330b72032ba/src/mai...
Hope this helps
@ArindamPatra15 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies