0

我有这个动态生成的网址:/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]
4

1 回答 1

0

假设你需要../index.php?product=bike重写为../product/bike/

RewriteCond %{QUERY_STRING} (^|&)product=(.*)(&|$)
RewriteRule ^(.*)/index.php$  $1/product/%1? [NC,L]
于 2013-08-08T12:24:27.240 回答