[英]rewrite an url with GET parameters
What rewrite rule in .htaccess
do I need to rewrite an url in the form 我需要什么
.htaccess
重写规则来重写以下形式的网址
http://localhost:8080/test/college_details.php?id=[some id]&name=[some name]
to the form 到表格
http://localhost:8080/test/[some name]/[some id]
For example, I'd like the URL http://localhost:8080/test/college_details.php?id=53&name=college-name
to be rewritten to http://localhost:8080/test/college-name/53
例如,我希望将URL
http://localhost:8080/test/college_details.php?id=53&name=college-name
重写为http://localhost:8080/test/college-name/53
Use below rule in test directory. 在测试目录中使用以下规则。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\d]+)$ college_details.php?id=$2&name=$1 [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.