我试图使用.htaccess重写包含查询字符串的网址。
基本上我试图更改此网址: http://www.myurl.com/index.php?page=case
..对此..
我的代码如下:
RewriteEngine On
RewriteRule ^case/?$ index.php?page=case [NC]
但这似乎根本没有做任何事情。
有什么建议吗?
答案 0 :(得分:1)
试试这个
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?page=(.*)\ HTTP
RewriteRule ^ /%2? [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?page=$1 [L]
它会将http://www.myurl.com/index.php?page=case
更改为http://www.myurl.com/case