Can ...
RewriteCond %{REQUEST_URI} ^/folder1/ [OR]
RewriteCond %{REQUEST_URI} ^/folder2/ [OR]
RewriteCond %{REQUEST_URI} ^/folder3/
RewriteRule (.*) / [R=301,L]
... be rewritten to ...
RewriteCond %{REQUEST_URI} ^/(folder1|folder2|folder3开发者_如何学运维)/
RewriteRule (.*) / [R=301,L]
?
And if so, are they absolutey identical in functionality?
Suggestions/improvements are much appreciated.They are the same thing, the |
stands for OR
so if it starts with /folder1/
or /folder2/
or /folder3/
do the redirect.
So yes it would be shorter and work out for your needs.
As Pekalski suggested you can make it shorter with:
^/folder[1-3]/
A few more examples and references can be found at: http://semlabs.co.uk/journal/mod_rewrite-quick-reference-and-cheat-sheet
精彩评论