Home htaccess file won't redirect internal pages
Reply: 0

htaccess file won't redirect internal pages

user1257 Published in July 19, 2018, 7:51 am

I have 2 domains, old.com and new.com.. I want to have all pages from old.com be 301 redirected to new.com and maintain the URL structure. So, if someone goes to old.com/about , they are redirected to new.com/about

As far as I can tell, everything in my htaccess file is correct. Here is the relevant section:

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ "http\:\/\/www\.new\.com\/$1" [R=301,L]

However, it's only redirecting the home page. If you go to old.com it redirects properly to new.com , but if you go to old.com/about, the page is not redirected to new.com at all.

I am using linux cPanel hosting on Godaddy, and also using wordpress. One thing that may be causing the issue is that in the file manager for the domains, old.com is the directly in the public_html folder , and new.com is its own directory within, so the path is public_html -> old.com -> new.com. A different developer set this up, so I am trying to figure out how to correctly have all pages redirected properly.

Thanks so much.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.654754 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO