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.
精彩评论