Michel Gokan Khan
Michel Gokan Khan

Reputation: 2625

Simplest URL rewrite rule not working in .htaccess

I'm trying to run following dummy URL rewrite rule, but every time I'm adding it nothing happens:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)(\.jpg)$ $1    
</IfModule>

Is there anything wrong with above rule ?

Upvotes: 0

Views: 65

Answers (1)

Eugeny
Eugeny

Reputation: 113

Your rule is pointless - you check in the RewriteCond if file doesn't exists and if so you try make redirect to the not existing file. mod_rewrite is smart enough to prevent that cand of rewriting hell, he is checking if uri after your RewriteRule doesn't changed, and if so he just ignoring this RewriteRule. So your RewriteRule must modify original uri or it will be ignored.

Upvotes: 2

Related Questions