时间:2021-07-01 10:21:17 帮助过:16人阅读
RewriteEngine OnRewriteBase /RewriteRule ^items/products/(\d+)/(.*)?$ items/products.php?number=$1&name=$2 [QSA,L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]
RewriteEngine OnRewriteBase /2014/RewriteRule ^phone/products/(\d+)/(.*)?$ phone/products.php?number=$1&name=$2 [QSA,L]RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule (.*) $1.php [L]
1)header跳转之所以报错,写法错误。header("Location:$url ");
另外里面的$_GET这几个如果不存在,又没有设置报错级别,那么还是容易报错
2)重写文件.htaccess 无需放到 /2014/目录,直接在原来的 / 重写即可
#by default7#zbphp.comRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^items/products/(\d+)/(.+)?$ 2014/phone/products/$1/$2/ [L,R=301]RewriteRule ^2014/phone/products/(\d+)/(.+)?$ phone/products.php?number=$1&name=$2 [PT,QSA,L]RewriteRule (.*) $1.php [L]