Reputation: 141
I have created two sitemap files for the same page:
Same page is working on two domains.
I need to create following rewrite rule in .htaccess:
Upvotes: 2
Views: 171
Reputation: 41249
You can use the following conditional rules in htaccess :
RewriteEngine on
##1)if host=="www.domain1.sk##
RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.sk$
##rewrite "/sitemap.xml" to "/sitemap_sk.xml"##
RewriteRule ^/?sitemap\.xml$ /sitemap_sk.xml [NC,L]
##2)if host=="www.domain2.com##
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$
##rewrite "/sitemap.xml" to "/sitemap_en.xml"##
RewriteRule ^/?sitemap\.xml$ /sitemap_en.xml [NC,L]
The first rule will rewrite /sitemap.xml to /sitemap_sk.xml if the host value is www.domain1.sk or domain1.sk .
The #2 rule will rewrite /sitemap.xml to /sitemap_en.xml if the host value is www.domain.com or domain.com .
Upvotes: 1