我怎样才能正确地重写.htaccess?
所以我的网址中有一个查询字符串:
/index.php?page=pageCount&subject=mySubject
我想将其更改为:
/index/pageCount/mySubject
以及
/show.php?subject=mySubject
到
/mySubject
以及
search.php?key=myKey
到
/key/myKey
感谢
答案 0 :(得分:0)
在.htaccess文件中
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index/([^/]+)/([^/]+)$ index.php?page=$1&subject=$2 [L,QSA]
RewriteRule ^key/([^/]+)$ search.php?key=$1 [L,QSA]
RewriteRule ^([^/]+)$ show.php?subject=$1 [L,QSA]