在example.com每个页面重定向到example.org

问题描述 投票:0回答:1

我想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的,在发展的转折点上的发展模式时,关闭缓存

.htaccess
1个回答
1
投票

检查这个1:1改写:

RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC] RewriteRule (.*) http://www.example.org/$1 [R=301,L]

© www.soinside.com 2019 - 2024. All rights reserved.