sanders
sanders

Reputation: 10898

.htaccess file modification

I have a .htaccess file which arranges that all requests go through index.php. Now i would like to make an exception for rss.php. to go straight throuh rss.php. How do I do this?

This is how it looks like now:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

Thanks.

Upvotes: 4

Views: 451

Answers (3)

CoffeeMonster
CoffeeMonster

Reputation: 2190

Or alternatively do a rewrite that matches the file then skips the rest of the rewrite tests.

By putting the following line before your existing RewriteRule will redirect without going through index.php.

RewriteRule  ^/rss.php  /rss.php  [L]

I came across this page while hunting for a way to do this with my /robots.txt file.

mod_rewrite with apache1.3

Upvotes: 0

Gumbo
Gumbo

Reputation: 655805

You can exclude any existing file with an additional RewriteCond directive:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Upvotes: 4

Ian Roke
Ian Roke

Reputation: 1784

Put this before the last line.

RewriteCond %{REQUEST_URI} !^/rss\.php$

Upvotes: 6

Related Questions