Bart Wesselink
Bart Wesselink

Reputation: 286

Rewrite all requests, excepts one folder

I'm new to htaccess, but I wanted to rewrite all urls coming to my webserver to index.php?params=$1, except the assets folder. I've tried something like this:

Options +FollowSymlinks
RewriteEngine on
RewriteRule !^assets($|/) index.php?params=$1 [NC]

But, when I use var_dump for the params variable, it returns an empty variable.

Thanks a lot

Upvotes: 1

Views: 78

Answers (1)

anubhava
anubhava

Reputation: 785108

This should work:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/(assets/|index\.php) [NC]
RewriteRule ^(.*)$ index.php?params=$1 [L,QSA]

Upvotes: 1

Related Questions