【发布时间】:2014-08-08 19:08:08
【问题描述】:
在将页面从旧折叠移动到新折叠时遇到了一些问题。
我以前的.htacess/var/www/html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^items/products/(\d+)/(.*)?$ items/products.php?number=$1&name=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
现在我更新我的网站。新建文件夹/var/www/html/2014
然后是另一个sub .htacess 在`/var/www/html/2014
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /2014/
RewriteRule ^phone/products/(\d+)/(.*)?$ phone/products.php?number=$1&name=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
</IfModule>
现在我想将www.example.com/items/products/1234/iphone-5c 移动到www.example.com/2014/phone/products/1234/iphone-5c
我尝试在旧页面items/products.php添加以下代码
<?php
header("Status: 301 Moved Permanently");
header('http://www.example.com/2014/phone/products/'.$_GET['number'].'/'.$_GET['name']);
exit;
?>
错误日志:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
我在/var/www/html中修改old .htacess
RewriteRule ^item/products/(\d+)/(.*)?$ items/products.php?number=$1&name=$2 [QSA,L]
=>
RewriteRule ^2014/phone/products/(\d+)/(.*)?$ items/products.php?number=$1&name=$2 [QSA,L,R=301]
重定向到404 page,如何正确操作?谢谢
【问题讨论】:
标签: php .htaccess mod-rewrite redirect header