httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Ionescu <>
Subject Re: [users@httpd] Problems with redirects...
Date Mon, 16 Feb 2009 19:26:11 GMT
2009/2/16 Ken Morley <>:
> Our httpd.conf file contains:
>    # Redirects to accomodate PDA's and other tiny screens...
>    RewriteCond %{HTTP_USER_AGENT} "BlackBerry" [NC]
>    RewriteCond %{HTTP_HOST} ^www\.saddlebrook\.com$ [NC]
>    RewriteRule ^/(.*) [L,R]
> This successfully detects BlackBerrys trying to access
> "" and successfully changes the URL to
> "" as I expected.
> But when the redirected browser runs through the rules again, the regexp
> "^www\.saddlebrook\.com$" is also matching the new URL
> "".  So it redirects endlessly.
> Why is regexp "^www\.saddlebrook\.com$" matching
>" and how can I make this work correctly?

Your RegEx ^/(.*) is open for every request. To catch the "root"
request only, change it to ^/$ instead. Your condition checks the host
header. You're redirecting to the same host (, why
should the host header be different? It should match against your
RegEx if the host was requested, of course.


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