Thursday, April 4, 2019

apache - RedirectCond Help for subdomains for www and www2

We have 2 subdomains www.mydomain.com and www2.mydomain.com. I'm trying to redirect pages to new site as below:




  • www.mydomain.com/support to newdomain.com/site1/page1.html

  • www2.mydomain.com/support to newdomain.com/site2/page2.html



I've set the redirect rule in httpd.conf as below:





RewriteCond %{HTTP_HOST} (www.)?mydomain.com



RewriteCond %{HTTP_HOST} !^$



RewriteRule ^/support/?$ http://newdomain.com/site1/page1.html [R=301,NC,L]



RewriteCond %{HTTP_HOST} (www2.)?mydomain.com



RewriteCond %{HTTP_HOST} !^$




RewriteRule ^/support/?$ http://newdomain.com/site2/page2.html [R=301,NC,L]




The first redirect rule is working fine, but not the other. In above case, both www and www2.mydomain.com/support are going to newdomain.com/site1/page1.html



Any help is appreciated!

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...