[英]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.