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?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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]
Hope it helps!
Nupur
Hi,
Why don't you set home page directly on Apache. Whenever there is a request for /, you can remap to home page.
Views
Replies
Total Likes
Hi @juliat95115877 ,
Can you try with mod_rewrite as mentioned here https://docs.adobe.com/content/help/en/experience-manager-dispatcher/using/configuring/dispatcher-co...
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.
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]
Hope it helps!
Nupur
Hi Nupur,
# custom rewrites
#Redirect Root page request to home page
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /content/abc/us/en/home-page.html [PT,L]
I wrote the above rule in my vhost file but get the below error log in dispatcher
172.17.0.1 "domainname:8080" - [27/Jul/2022:11:40:29 +0000] "GET / HTTP/1.1" 404 5615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
[27/Jul/2022:11:40:29 +0000] "GET /content/abc/us/en/errors/404.html HTTP/1.1" - hit [publishfarm/-] 15ms "domainname:8080"
I have defined an Error Document directive too as below -
ErrorDocument 404 /content/abc/us/en/errors/404.html
Can you help as to why the redirect is not working ?
Views
Replies
Total Likes
Views
Likes
Replies