httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serge Fonville <serge.fonvi...@gmail.com>
Subject Re: [users@httpd] redirect based on HTTP_HOST using mod_rewrite
Date Wed, 25 Jan 2012 22:03:50 GMT
Hi,

RewriteCond does an AND unless you tell it to do an OR.

You mention the querystring, but /unauthorized isn't it, is it?

if you want to filter based on the urlpath you should do it differently.

Please add the information so we better understand what you are trying to
accomplish.

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Google!!
They need to add GAL support on Android (star to agree)
http://code.google.com/p/android/issues/detail?id=4602


2012/1/25 Thomas CarriƩ <thocar@free.fr>

> Hi,
>
> I have 2 DNS entries
> - a.domain.com
> - b.domain.com
>
> They target the same IP: 1.2.3.4
>
> I want to setup apache
> - to accept requests on a.domain.com
> - to forbid requests on b.mydomain.com
>
> I have tried this config
>
> Listen 1.2.3.4:80
> <VirtualHost 1.2.3.4:80>
>    ServerName a.domain.com
>    # page to be served for users that try to access b.domain.com
>    # instead of a.domain.com
>    Alias /unauthorized /var/www/unauthorized.txt
>
>    RewriteEngine On
>    RewriteCond %{HTTP_HOST}  =b.domain.com
>    RewriteCond %{QUERY_STRING} !unauthorized
>    RewriteRule ^/(.*)$ /unauthorized
>
> It is the first time I use module mod_rewrite is totally new to me, 2
> things
> are unclear to me:
>
> - how to do a logical AND condition :
>      HTTP_HOST is b.domain.com
>      and QUERY_STRING is not /unauthorized
>
> - what kind of option to add to RewriteRule to avoid infinite recursion
>
> Thomas
>
> ---------------------------------------------------------------------
> 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