我需要用.htaccess
重写规则来重写表格
http://localhost:8080/test/college_details.php?id=[some id]&name=[some name]
到表格
http://localhost:8080/test/[some name]/[some id]
例如,我希望将网址http://localhost:8080/test/college_details.php?id=53&name=college-name
重写为http://localhost:8080/test/college-name/53
答案 0 :(得分:1)
在测试目录中使用以下规则。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\d]+)$ college_details.php?id=$2&name=$1 [QSA,L]