繁体   English   中英

用GET参数重写网址

[英]rewrite an url with GET parameters

我需要什么.htaccess重写规则来重写以下形式的网址

http://localhost:8080/test/college_details.php?id=[some id]&name=[some name]

到表格

http://localhost:8080/test/[some name]/[some id]

例如,我希望将URL http://localhost:8080/test/college_details.php?id=53&name=college-name重写为http://localhost:8080/test/college-name/53

在测试目录中使用以下规则。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM