[英]htaccess rewrite rule for url parts
My url looks lik: 我的网址看起来不错:
http://example/en/account/register
I want to catch with regexp this url 我想用正则表达式捕获此URL
RewriteRule ^(\w{2}+)/(^account)$
In this rule I want have all url that contain http://example/en/account/
在此规则中,我希望所有包含
http://example/en/account/
网址
I can't found where is problem in my regexp, because this regexp is not correct for that url ... 我在我的正则表达式中找不到问题所在,因为此正则表达式不适用于该网址...
You can use this pattern: 您可以使用以下模式:
RewriteRule ^(\w{2})/(account)/?$ your-handler [L]
2 points about your regex: 关于正则表达式的2点:
\\w{2}
not \\w{2}+
\\w{2}
而不是\\w{2}+
^
in the middle of your regex as it means start of input. ^
,因为这意味着开始输入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.