Reputation: 2012
I have a wordpress site which is www.mydomain.com . This site has a page www.mydomain.com/sub-page
I also have a new domain, www.newdomain.com which is pointed to the same root/site, but I want people that use this domain to get redirected to www.mydomain.com/sub-page
Here is my htaccess, Im not sure of the syntax, but at the moment this is doing nothing, www.newdomain.com simply loads www.mydomain.com
RewriteCond %{HTTP_HOST} ^www\.newdomain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^newdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/sub-page [R=301,L]
Upvotes: 3
Views: 2656
Reputation: 7073
Try this code :
RewriteCond %{HTTP_HOST} ^www.newdomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/sub-page [R=301,L]
Upvotes: 5