rewritecond exclude url in .htaccess

I have these working rewrite rules :

# Allow access to assets folder from plugins folders
RewriteRule ^app/plugins/(.+)/assets - [L]

# forbid access to files and folders under app
RewriteRule ^app/.*$ - [L,F]

# rewrite to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?action=$1 [L,QSA]

Now I would like to exclude from these rules everything located under http://www.mywebsite.com/wordpress/
Therefore I’ve added a new rewrite condition :

Read More
...
# rewrite to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wordpress/ [NC]
RewriteRule ^(.*)$ index.php?action=$1 [L,QSA]

But it dosen’t work. When I try to access something like this :
http://www.mywebsite.com/wordpress/contact-us/

it redirects me to index.php…

Any help would be really appreciated.

Related posts

Leave a Reply

1 comment

  1. Ok I finally found what was going wrong with all of this :
    In fact I did not notice that a .htaccess file was present in my /wordpress directory.
    So on the .htaccess of my root directory I’ve added this rule on top of all the others :

    RewriteRule ^wordpress - [L]
    

    Then in the .htaccess of the wordpress directory I’ve these rules :

    RewriteBase /wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    

    I don’t know if everything is optimized but it works !