David
David

Reputation: 2423

.htaccess RewriteCond question

I have this in my .htaccess:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/includes
RewriteCond %{REQUEST_URI} !/images
RewriteRule (.*) index.php

It redirects all pages through index.php with the exception of the includes and images folder. Is this the correct way to use the exceptions? Also is there a way to use the exceptions on just one RewriteCond rule instead of each on a seperate line?

Upvotes: 0

Views: 355

Answers (1)

Ben
Ben

Reputation: 3972

That is fine for the exceptions, though you could add a ^ inbetween the ! and / to make it says "starts with". As for combining them, you can do the following:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/(includes|images)
RewriteRule (.*) index.php

Upvotes: 2

Related Questions