Reputation: 1915
I'm wanting every page of www.example.com to redirect to www.example.org
I'm using the following .htaccess in the root of example.com
RewriteEngine on
RewriteRule ^(.*)$ https://www.example.org/$1 [R=301,L]
if I navigate to www.example.com, I'm redirected to www.example.org - that's great
If I navigate to www.example.com/example.php I get a 404 from example.com
Edit: Cloudflare was caching files, the accepted answer as well as the method in the question work to redirect files to the appropriate page. If using Cloudflare, turn OFF caching by turning on development mode when in development
Upvotes: 0
Views: 45
Reputation:
Check this 1:1 rewrite:
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC] RewriteRule (.*) http://www.example.org/$1 [R=301,L]
Upvotes: 1