Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Dispatcher Root Mapping

juliat95115877
Level 1
Level 1

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
1 Accepted Solution
Nupur_Jain
Correct answer by
Community Advisor
Community Advisor

 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

View solution in original post

5 Replies
Arun_Patidar
Community Advisor
Community Advisor

Hi,

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

juliat95115877
Level 1
Level 1
I wasn't sure if that was the correct approach. I don't have direct access to Apache and have to go through another team for that.
vanegi
Employee
Employee

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.

Nupur_Jain
Correct answer by
Community Advisor
Community Advisor

 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

View solution in original post