How to point the default dispatcher URL to a particular site homepage? | Community
Skip to main content
Level 2
July 19, 2023
Solved

How to point the default dispatcher URL to a particular site homepage?

  • July 19, 2023
  • 4 replies
  • 987 views

I have multiple projects such as /content/A, content/B, content/C. I want my dispatcher default URL to point to C homepage. Currently its pointing to Bs homepage. I m not sure which file needs to be changed to achieve this. Any help is highly appreciated.

 

Thank you.

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

You can refer to the wknd code base at https://github.com/adobe/aem-guides-wknd/blob/main/dispatcher/src/conf.d/rewrites/rewrite.rules

The rewrite.rules file has a rule for redirecting all root traffic as shown below - 

# redirect all root traffic to US home page
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^(/)$ /us/en.html [R=301,L,E=cdncache]

Modify the /us/en.html to content/C.html in your own codebase. Hope this helps!

 

4 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 19, 2023

This sounds like you have a redirect somewhere which will point to "B" when you hit "/". You can be sure by checking the headers of the request, so I would start looking at the rewrite rules first. 

Esteban Bustamante
BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 19, 2023

My understanding is you have a domain with 3 regions:

www.sourcedcode.com/en-a 

www.sourcedcode.com/en-b 

www.sourcedcode.com/en-c 

 

When you visit www.sourcedcode.com , you want visitors to resolve www.sourcedcode.com /en-c.

 

Currently it sounds like the root page, which is www.sourcedcode.com / is pointing towww.sourcedcode.com /en-b.

 

Here's what you need to do to push users to www.sourcedcode.com /en-c. when visiting www.sourcedcode.com.

 

At ease, find all the rewrite rules, where the file will have the redirect rules all organized, and then

try to find (existing configuration)

RewriteRule ^/?$ https://www.sourcedcode.com/en-b [R=301,L]

change it to
RewriteRule ^/?$ https://www.sourcedcode.com/en-c [R=301,L]

 

(if you are using AEMaaCS, push the code into the respository), and if you are using on-prem, then restart the web server.

 

in doing this, now visiting www.sourcedcode.com or www.sourcedcode.com/, visitors will resolve to https://www.sourcedcode.com/en-c.

Rohan_Garg
Community Advisor
Rohan_GargCommunity AdvisorAccepted solution
Community Advisor
July 20, 2023

You can refer to the wknd code base at https://github.com/adobe/aem-guides-wknd/blob/main/dispatcher/src/conf.d/rewrites/rewrite.rules

The rewrite.rules file has a rule for redirecting all root traffic as shown below - 

# redirect all root traffic to US home page
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^(/)$ /us/en.html [R=301,L,E=cdncache]

Modify the /us/en.html to content/C.html in your own codebase. Hope this helps!

 

aanchal-sikka
Community Advisor
Community Advisor
July 20, 2023

@silvia_joyce_balraj 

 

Here we need to check the rewrite rule, thats expanding/rewriting the URL. 

 

  • Find the vhost file that matches the domain.
  • Check for rewrite in the vhost file as suggested by @briankasingli  and update it with the required path.

 

Aanchal Sikka