我如何重写这个网址:
http://www.example.com/album?album_id=52
到此:
http://www.example.com/album/52
我的.htaccess代码是:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^album/$ album?album_id=$1 [L]
答案 0 :(得分:0)
您需要首先从模式中捕获相册ID,然后才能将其用作$1
:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^album/([0-9]+)/?$ album?album_id=$1 [L,QSA]