httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apisilp Trunganont" <>
Subject [users@httpd] How to redirect every document URL except image?
Date Sun, 22 Sep 2002 13:50:24 GMT

My web site has 2 URL which contains same content.
( and
Visitors get same as But I will terminate and use only
So I write Rewrite Rule like this.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.co\.th$
RewriteRule ^/(.+)$$1 [R]

This rule works. If visitors request,
web server will redirect to
But I found a problem about images. If test.html contains
this tag:

<img src="">

Web browser will diaplay broken image. Because browser
requests and server
responses redirect command, not image data. Browser
receives redirect command but doesn't try to request
again. So it doesn't understand image format which contains
"Location: ..." and displays broken image.

So I should redirect every document to new URL except
images (*.gif, *.jpg). I writes new Rewrite Rule like this.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.co\.th$
RewriteRule ^/(.+)(?<!\.(gif|jpg))$$1 [R]

It doesn't work. Apache tells me "RewriteRule: cannot compile
regular expression '^/(.+)(?<!\.(gif|jpg))$'". I think this regexp
is too complicate.

Anyone has the advice?


Join the world’s largest e-mail service with MSN Hotmail.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message