Expand my Community achievements bar.

href="/" not taking me to the home page.

Avatar

Level 2

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

Topics help categorize Community content and increase your ability to discover relevant content.

6 Replies

Avatar

Community Advisor

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

Avatar

Level 2

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!

Avatar

Level 2

Hi @pulkitvashisth , This issue is in my local too. Do you think, its a dispatcher issue?

Avatar

Community Advisor

No @ArindamPatra15 


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.

Avatar

Administrator

@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!



Kautuk Sahni