我正在尝试更新我的.htaccess
如下…
旧url: http://piesyearly.com/
new url: http://yearly.pies.com/
它们都位于以下文件结构中:
/public_html
htaccess.txt
../domains
../../piesyearly -->piesyearly.com
../yearlysubdomain -->yearly.pies.com
我已经尝试将此添加到旧网站的header.php
,但它将每个链接重定向到主页,而不是它在新域的各自路径:
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://yearly.pies.com");
我也试过修改我的htaccess.txt
,但没有任何改变:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^piesyearly.com$ [NC]
RewriteRule ^ http://yearly.pies.com%{REQUEST_URI} [L,R=301,NE]
显然这里很混乱
如果两个站点上的子路径相同,那么只需在Apache级别执行以下操作:
RedirectPermanent / http://yearly.pies.com/
子url将被正确地发送到新域名上相同的子url。不需要任何重写,因为它是一个基本的/简单的1:1映射