我想重写以下网址:
localhost/beta/coupons.php?cat=promotions point to ---> localhost/beta/coupons/promotions
localhost/beta/coupons.php?city=ny point to ---> localhost/beta/coupons/ny
我在.htaccess
中运行此代码 <IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /beta/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^coupons/([^/]*)$ coupons.php?cat=$1 [L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^coupons/([^/]*)$ coupons.php?city=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^coupons/([^/]+)/([^/]+)?$ coupons.php?cat=$1&city=$2 [L]
</IfModule>
代码只运行第一次重写,第二次不起作用。
非常感谢你的时间。