httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] How to redirect every document URL except image?
Date Sun, 22 Sep 2002 14:01:55 GMT
Apisilp Trunganont wrote:

> 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.

In version 2 you can use Perl-compatible regular expressions, but in 
version 1.3 you can only use POSIX regular expressions (check "man 
egrep" or the like).

Your problem is fairly easy, however:

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


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