如何创建适用于 urlencoded 值的 Apache mod_rewrite 规则?
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= [NC,L]
什么是可以用来代替 [a-z0-9]
以接受 urlencode
函数返回的有效字符范围的正则表达式?
您可以捕获任何内容,直到您获得带有 RewriteCond
的 /
以防止循环:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?test= [QSA,L]
我正在使用 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= [NC,L]
什么是可以用来代替 [a-z0-9]
以接受 urlencode
函数返回的有效字符范围的正则表达式?
您可以捕获任何内容,直到您获得带有 RewriteCond
的 /
以防止循环:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?test= [QSA,L]