【发布时间】:2014-10-26 14:20:27
【问题描述】:
我有两个带有永久链接的 wordpress 网站 NEW 和 OLD。旧网站位于http://website.com/old,新网站位于http://website.com。
我想使用 .htaccess 将我的所有 IP 重定向到旧网站 (http://website.com/old)。
位于主目录 (http://website.com) 的默认 .htaccess 是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我已将其更改为以下内容(其中 xx.xxx.x.xxx 是我的 IP):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^xx.xxx.x.xxx
RewriteRule .* http://website.com/old [R=302,L]
</IfModule>
此时我可以将所有内容重定向到除我的 IP 之外的旧网站。问题是当我导航到我的新网站上的任何页面时,例如 http://website.com/contacts 它会返回:
Not Found
The requested URL /contacts/ was not found on this server.
Apache Server at website.com Port 80
有什么想法吗?谢谢
【问题讨论】:
标签: wordpress .htaccess redirect ip permalinks