Re: Redirection with 301 for all subdomains with exception

From: Willy Tarreau <w#1wt.eu>
Date: Fri, 3 Jul 2009 14:48:27 +0200


On Fri, Jul 03, 2009 at 12:25:46PM +0200, Falco SCHMUTZ wrote:
> Hello,
> I have one question more about redirection :
> We want to redirect one old domain to the new one with some conditions.
>
> We configure some acl like this and it's work fine :
>
> acl es path_beg /es
> redirect location http://www.newdomain.com/es/marruecos.html if es
> acl en path_beg /en
> redirect location http://www.newdomain.com/en/morocco.html if en
> acl www hdr(host) -i www.
> redirect location http://www.newdomain.com/maroc.html if www
>
>
> But we need one action when some users used old link maybe like this :
>
> http://www.olddomain.com/olddirectory/oldhtmlpage.*
> http://www.olddomain.com/es/olddirectory/oldhtmlpage.*
> http://www.olddomain.com/en/olddirectory/oldhtmlpage.*
>
> do you know if with the first acl configuration, we can redirect user to :
>
> http://www.newdomain.com/olddirectory/oldhtmlpage.*
> http://www.newdomain.com/es/olddirectory/oldhtmlpage.*
> http://www.newdomain.com/en/olddirectory/oldhtmlpage.*

yes, you can do that using "redirect prefix" that way :

acl olddom hdr_end(host) -i olddomain.com redirect prefix http://www.newdomain.com if olddom

The redirect rule will then cause a "Location: http://www.newdomain.com/<olduri>" header to be emitted. It's typically useful to change domains or to switch between http and https.

Regards,
Willy Received on 2009/07/03 14:48

This archive was generated by hypermail 2.2.0 : 2009/07/03 15:00 CEST