Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

HI,

I have a working redirection that looks like this

RewriteRule ^(.*)weihnachtsshop/(.*)$ /hochzeitsshop [R=301,L]

everything like www.shop.com/weihnachtsshop/product.html get's redirceted to www.shop.com/hochzeitsshop.

My problem now is, that i need this redirection to exclude all images, like www.shop.com/weihnachtsshop/product.jpg - these links should not get rewritten.

What's the best way to approach this?

PAT

share|improve this question
    
I'd be interested in the solution to this too. –  Jonathan Ross Mar 29 '11 at 13:36
1  
RewriteCond %{REQUEST_FILENAME} !-f redirects only file that does not exist. It could be enough in your case no ? –  Serty Oan Mar 29 '11 at 13:50
add comment

1 Answer

up vote 4 down vote accepted

One way:

RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|gif|png)$
RewriteRule ^(.*)weihnachtsshop/(.*)$ /hochzeitsshop [L,R=301]
share|improve this answer
    
and bmp or tiff, webp ? :p (just kidding) –  Serty Oan Mar 29 '11 at 14:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.