Thursday 4 April 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...