I have a below code in mod-rewrite.txt
RewriteEngine On
RewriteRule /\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} !www\.espireinfo\.com$
RewriteRule ^(.*)$ http://www\.espireinfo\.com$1 [R=301,L]
RewriteRule ^/schools/index.aspx$ /schools/english-language.aspx [R=301,L]
RewriteRule ^/about/Contact.aspx$ /about/contact.aspx [R=301,L]
As you can see that above is using http://www.espireinfo.com domain for rewriting. I want one more domain http://www.rai.com with below configuration to be written in same mod-rewrite file.
RewriteCond %{HTTP_HOST} !www\.rai\.com$
RewriteRule ^(.*)$ http://www\.rai\.com$1 [R=301,L]
RewriteRule ^/schools/index.aspx$ /schools/eng-lang.aspx [R=301,L]
RewriteRule ^/about/Contact.aspx$ /about/contactdetails.aspx [R=301,L]
So my complete mod-rewrite.txt file will be given as below:
RewriteEngine On
RewriteRule /\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} !www\.espireinfo\.com$
RewriteRule ^(.*)$ http://www\.espireinfo\.com$1 [R=301,L]
RewriteRule ^/schools/index.aspx$ /schools/english-language.aspx [R=301,L]
RewriteRule ^/about/Contact.aspx$ /about/contact.aspx [R=301,L]
RewriteCond %{HTTP_HOST} !www\.rai\.com$
RewriteRule ^(.*)$ http://www\.rai\.com$1 [R=301,L]
RewriteRule ^/schools/index.aspx$ /schools/eng-lang.aspx [R=301,L]
RewriteRule ^/about/Contact.aspx$ /about/contactdetails.aspx [R=301,L]
I tried this but is it only responding to first domain http://www.espireinfo.com.
Is it possible to control two domain with same rewriterule in same mod-rewrite.txt file.
Please suggest what I can do to solve this issue. I will be very grateful for your help!
You want to have one server behave as two different servers by default, it cant do that.
You have to pick one to be the default for the 301 redirect. then keep only one of those sections.
Then add the correct condition on the page re-writes. Thus for espireinfo being the defualt
That is unless I’ve mistaken your domain name rewrites, ie if you are actually trying to force www prefix.