0
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteLog "/private/var/log/apache2/rewrite.log"
    RewriteLogLevel 3
    RewriteCond %{REQUEST_URI} !^/etc$  [OR]
    RewriteCond %{REQUEST_URI} !^/libs$ [OR]
    RewriteCond %{REQUEST_URI} !^/bin$  [OR]
    RewriteCond %{REQUEST_URI} !^/home$ [OR]
    RewriteCond %{REQUEST_URI} !^/var$  [OR]
    RewriteCond %{REQUEST_URI} !^/content$ [OR]
    RewriteCond %{REQUEST_URI} !^/siteadmin$
    RewriteRule ^/([^/]*)/([^/]*)/(.*)$  /content/wu/$2_$1/$3 [PT,L]
</IfModule>
2
  • Nice config. Did you have a question? Apr 25 '13 at 23:48
  • Do you really have docroot set to the root of your filesystem? Also, check the meaning of "OR"... Apr 26 '13 at 4:23
3

Using [OR] with multiple "not" (!) patterns means that every URL will match a RewriteCond.

examples:

  • "/foo" matches all of your "RewriteCond" statements and will hit the RewriteRule.
  • "/etc" is excluded by the first rule but matches all the others (/etc is not /libs) so it also will hit the RewriteRule.
  • same goes for /libs, /bin and the rest you're trying to keep from being requested.

You probably intend to use the default AND behavior. You want the path to not be /etc AND /libs AND /bin AND /home, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.