Dispatcher Root Mapping

juliat95115877

09-07-2020

How can I set the default page for a dispatcher?

In the past, our site was using a load balancer with the publishers, and the Day CQ Root Mapping setting handled the page to load when the base URL was hit. We're moving to a dispatcher on a rebuild of the site, and the root mapping doesn't seem to be working. 

Everything I can find regarding URLs for the dispatcher is about rewriting the displayed URL as best as I can tell, but I don't understand how to define the primary page for the site. Is that a setting for the dispatcher or on the server? Will URL mapping from the primary domain to the page we want to be the home page solve this problem?

Additionally, if URL mapping is what I need to do, we're currently just using the dispatcher URL for testing but will be setting a different URL when we switch over. Is there a way to map URLs for both domains for sling:match?

Dispatcher

Accepted Solutions (1)

Accepted Solutions (1)

Nupur_Jain

MVP

10-07-2020

 hi @juliat95115877 ,

 

If you are using apache server with dispatcher, you can use apache's rewrite rule to redirect ROOT request to sitte home page. Dispatcher is just the module but actual redirection should be handled using apache server only. Find below the sample rewrite rule which you can use:

#Redirect Root page request to home page
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^(mysite.com)$ [NC]
RewriteRule ^/ https://%{HTTP_HOST}/en/home.html [L,R=301]

 

  • You will have to enable rewrite module on apache fiest
  • you can then modify apache rule and add it to vhost file of your site
  • Here 301 that is permanent redirection will make sure to redirect any further root request to home page 

Hope it helps!

Nupur

Answers (3)

Answers (3)

Arun_Patidar

MVP

09-07-2020

Hi,

Why don't you set home page directly on Apache. Whenever there is a request for /, you can remap to home page.

vanegi

Employee

09-07-2020

If you are using Apache, you can use the mod_rewrite module to specify a default page /homepage. See the Apache web site documentation for information about mod_rewrite (for example, Apache 2.4 ). When using mod_rewrite , it is advisable to use the flag 'passthrough|PT' (pass through to next handler) to force the rewrite engine to set the uri field of the internal request_rec structure to the value of the filename field.