我需要重写下面的链接
www.website.com/folder1/folder2/index.php?name=value
是这样的:
www.website.com/folder1/folder2/name/
我用这行代码尝试了htaccess,但它没有用。
RewriteEngine on
RewriteRule ^name/([A-Za-z0-9-]+)/?$ index.php?name=$1 [NC,L]
提前谢谢!
答案 0 :(得分:0)
在/folder1/folder2/.htaccess
:
RewriteEngine On
RewriteBase /folder1/folder2/
RewriteCond %{THE_REQUEST} /index\.php\?name=([^\s&]+) [NC]
RewriteRule ^ name/%1? [R=302,L,NE]
RewriteRule ^name/([A-Za-z0-9-]+)/?$ index.php?name=$1 [NC,QSA,L]