![](/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.