我想重写以下网址:
http://www.web.de/productCat1- >将Var productCat1传递给productCat.php
http://www.web.de/productCat1/product20- >将Var productCat1 + Var product20传递给products.php
http:// www .web.de / shop- >不存在文件时不执行
http://www.web.de/contact- >不存在文件时不执行
到目前为止,我有这个:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# PHP to NO Extension
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1\.php
#catch all products
RewriteCond %{REQUEST_URI} ^/([^/]+/[^/]+)/{0,1}$
RewriteRule ^([^/]+/[^/]+)/{0,1}$ /products.php?rw=1&url=$1/$2 [L,QSA]
#catch all categories
RewriteCond %{REQUEST_URI} !^/(shop|contact)$
RewriteRule ^([^/]+)$ /productCat.php?rw=1&url=$1/$2 [L,QSA]
经过几次尝试后,我仍然收到500 Internal Server Error。
尝试:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# PHP to NO Extension
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1\.php
#catch all products
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+/[^/]+)/?$ /products.php?rw=1&url=$1 [L,QSA]
# catch all categories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/? /productCat.php?rw=1&url=$1 [L,QSA]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句