httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
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))$ http://www.domain.com/$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 ^/(.*)$ http://www.domain.com/$1 [R]

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message