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

link|improve this question

20% accept rate
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
feedback

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]
link|improve this answer
and bmp or tiff, webp ? :p (just kidding) – Serty Oan Mar 29 '11 at 14:12
feedback

Your Answer

 
or
required, but never shown

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