开发者

Apache RewriteRule: Which one has the best performance: ^(.+) vs (.*) and ^.*$ vs .*$ ? Is there any difference?

Is there any different between ^(.+) and (.*)?

RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteRule (.*)/$ /$1 [R=301,L]

And between ^.*$ and .*$?

开发者_开发百科
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^.*$ %{REQUEST_URI}%1? [R=301,L]
RewriteRule .*$ %{REQUEST_URI}%1? [R=301,L]

Which one has the best Apache .htaccess performance?


They are not even equal. The first variant requires at least one character at the beginning, and the other also matches the single slash. Sorry, I don't know enough about these regexes to make a guess about the performance, but despite the difference, they should be equal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜