Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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!

 

View solution in original post

4 Replies

Avatar

Community Advisor

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

Avatar

Community Advisor

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.

Avatar

Correct answer by
Community Advisor

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!

 

Avatar

Community Advisor

@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