![](/img/trans.png)
[英]is there a PHP function to simulate how apache mod_rewrite works?
[英]How do I create an Apache mod_rewrite rule that works with urlencoded values?
我正在使用php函數urlencode http://php.net/manual/en/function.urlencode.php編碼GET參數$_GET['test']
我想使用apache重寫規則將website.com/%CE%A6
URL重寫為website.com/index.php?test=%CE%A6
RewriteRule ^([a-z0-9])/?$ /index.php?test=$1 [NC,L]
什么是可以代替[a-z0-9]
接受urlencode
函數返回的有效字符范圍的正則表達式?
您可以捕獲任何東西,直到獲得帶有RewriteCond
的/
以防止循環為止:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?test=$1 [QSA,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.