我有这个动态生成的网址:/folder/folder/folder/folder/index.php?product=bike
我需要将其转换为静态网址:/folder/folder/folder/folder/product/bike
.htaccess位于根文件夹
中码
RewriteCond %{QUERY_STRING} ^product=1$
RewriteRule ^([^/]+)/? index.php?product=$1 [L]
答案 0 :(得分:0)
假设您需要将../index.php?product=bike
重写为../product/bike/
RewriteCond %{QUERY_STRING} (^|&)product=(.*)(&|$)
RewriteRule ^(.*)/index.php$ $1/product/%1? [NC,L]