我想www.example.com的每一个页面重定向至www.example.org
我使用下面的.htaccess在example.com的根
RewriteEngine on
RewriteRule ^(.*)$ https://www.example.org/$1 [R=301,L]
如果我浏览到www.example.com,我重定向到是www.example.org - 这是伟大的
如果我浏览到www.example.com/example.php我收到来自example.com的404
编辑:CloudFlare的是缓存文件,接受的答案,以及在问题的工作方法,以文件重定向到相应的页面。如果使用CloudFlare的,在发展的转折点上的发展模式时,关闭缓存
检查这个1:1改写:
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC] RewriteRule (.*) http://www.example.org/$1 [R=301,L]