href="/" not taking me to the home page. | Community
Skip to main content
New Participant
September 12, 2024

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

  • September 12, 2024
  • 3 replies
  • 1149 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

kautuk_sahni
Employee
September 25, 2024

@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
EstebanBustamante
New Participant
September 13, 2024
pulkitvashisth
New Participant
September 12, 2024

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
New Participant
September 13, 2024

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!

New Participant
September 13, 2024

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