[英]The usage of .htaccess to re-write the url
我寫了.htaccess來重寫以下網址:
confirmreg.php
至
http://keralapsctuts.com/confirm-registration.html
和
confirmreg.php?code=nsfoh98fkjsdf90
至
http://keralapsctuts.com/code/62fdd2ac2709877a81ecfd7dde9d2810/confirm-registration.html
.htaccess規則為
RewriteRule confirm-registration\.html$ confirmreg.php [QSA,L]
RewriteRule code/(.*)/confirm-registration\.html$ confirmreg.php?code=$1 [QSA,L]
回聲獲取不返回代碼的值
echo "Code: ". $_GET['code'];
改進的代碼:
RewriteRule ^confirm-registration\.html$ confirmreg.php [QSA,L]
RewriteRule ^code/([0-9a-z]+)/confirm-registration\.html$ confirmreg.php?code=$1 [QSA,L]
給RewriteRule一個開始^
RewriteRule ^
(可選)更具體地指定要排除的字符。
code/([0-9a-z]+)/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.