我正试图编写一个重写规则,将特定的URL转换为不同的URL。
网址:http://www.example.com/index.php?r=site/action¶m1=value1
期望结果:http://www.example.com/value1
我正在尝试的htaccess是:
RewriteEngine On
RewriteRule ^index'.php'?r=site/action¶m1=([a-zA-Z])$ $1 [L]
但这行不通。你能帮我吗?
您可以在根目录中使用此规则。htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?r=site/action¶m1=$1 [L,QSA]