Re: Redirection with 301 for all subdomains with exception

2009-07-08 Thread Willy Tarreau
Hi,

On Mon, Jul 06, 2009 at 02:05:09PM +0200, Falco SCHMUTZ wrote:
 Hello,
 I m sorry to disturb you again, but some problem persist.
 
 This is my final configuration and it works fine :
 
 acl es path_beg /es
 redirect location http://www.newdomain.com/es/marruecos.html code 301 if es
 acl en path_beg /en
 redirect location http://www.newdomain.com/en/morocco.html code 301 if en
 acl www hdr(host) -i www.
 redirect location http://www.newdomain.com/maroc.html code 301 if www
 acl admin hdr_beg(host) -i admin
 redirect location https://admin.newdomain.com code 301 if admin
 acl pro hdr_beg(host) -i pro
 redirect location http://pro.newdomain.com code 301 if pro
 acl olddom hdr_end(host) -i olddomain.com
 redirect prefix http://www.newdomain.com code 301 if olddom
 
 But url  with some page html do not rewrite correctly with extension path
 /es/ or /en/ :
 Ex :
 http://www.olddomain.com/es/promotions.html -
 http://www.newdomain.com/es/marruecos.html

This is normal, as this is what you have written in the first rule.

 but we need
 http://www.olddomain.com/es/promotions.html -
 http://www.newdomain.com/es/promotions.html

I think that the problem comes from the fact that you're only able
to enumerate examples of what you need and not an exhaustive list.
Once your list is exhaustive, it will become clear how to arrange
your rules so that they do what you need.

 For information we really need this and currently work fine :
 http://www.olddomain.com/es/ - http://www.newdomain.com/es/marruecos.html

Maybe you only want to redirect a URL ending with /es/ to
/es/marruecos.html ? I don't really know, there's nothing
very clear.

Regards,
Willy




Re: Redirection with 301 for all subdomains with exception

2009-07-03 Thread Falco SCHMUTZ
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.*

Many thanks for you help :)

Best regards,

Falco

2009/6/24 Falco SCHMUTZ fschm...@lovaservices.net

 Thanks, it's worked great !Good night
 Falco

 2009/6/23 Falco SCHMUTZ fschm...@lovaservices.net

 Ok, thanks Willy, i will try.Falco

 2009/6/23 Willy Tarreau w...@1wt.eu

 On Mon, Jun 22, 2009 at 08:32:36PM +0200, Falco SCHMUTZ wrote:
  Hello everybody,
  Could you help to fix this configuration ?
 
  I need to redirect all sub domains except 5 (admin, pro, www, img*,
  domain.com without sub domain) to www.domain.com
 
  I test this setting, but did not work.
 
  acl good_subs url_beg admin pro www img*
  redirect location www.domain.com 301 if  !good_subs

 the host name is not in the url but in the Host: header. So you
 must do that instead :

   acl good_subs hdr_beg(host) -i admin. pro. www. img

  I have no idea for http://domain.com to http://www.domain.com and i
 did not
  know if img with wildcard work.

 You can do that :
   acl good_subs hdr_beg(host) -i admin. pro. www. img domain.com

 For the wildcard you don't need anything special as hdr_reg() matches
 at the beginning of the field. However if you need finer combinations,
 check with the regexes. It will be harder to configure but with
 infinite combinations.

 Willy






Re: Redirection with 301 for all subdomains with exception

2009-07-03 Thread Willy Tarreau
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




Re: Redirection with 301 for all subdomains with exception

2009-07-03 Thread Falco SCHMUTZ
Sorry,
Ok, i do it short, i need just 3 fix redirect in 301:
http://www.olddomain.com/es/  - http://www.newdomain.com/es/marruecos.html
http://www.olddomain.com/en/  - http://www.newdomain.com/en/morocco.html
http://www.olddomain.com/   - http://www.newdomain.com/maroc.html

This is use for inform my user because the site change, and there is
redirect to a special page by country.

But some request from google use old page and i need to move it in 301.
So i just need to all others requests possibles are redirect too.
www.olddomain.com/* - www.newdomain.com/*

Maybe it s quite simple like this ?
Sorry to confuse you :-(
Thanks
Falco

2009/7/3 Willy Tarreau w...@1wt.eu

 On Fri, Jul 03, 2009 at 03:04:56PM +0200, Falco SCHMUTZ wrote:
  Thanks at all,
  Are you sure i can use :
 
  this first configuration :
  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
 
  then :
  acl olddom hdr_end(host) -i olddomain.com
  redirect prefix http://www.newdomain.com if olddom
 
  because i really need to redirect
  http://www.olddomain.com/es/
 http://www.newdomain.com/olddirectory/oldhtmlpage.*
  - http://www.newdomain.com/es/marruecos.html
  http://www.olddomain.com/en/
 http://www.newdomain.com/es/olddirectory/oldhtmlpage.*
  - http://www.newdomain.com/en/morocco.html
  http://www.olddomain.com/
 http://www.newdomain.com/en/olddirectory/oldhtmlpage.*
  - http://www.newdomain.com/maroc.html
 
  then old directory and old html page to
 
  http://www.olddomain.com/directory/htmlpage.* -
  http://www.newdomain.com/directory/htmlpage.*
  http://www.olddomain.com/es/directory/htmlpage.* -
  http://www.newdomain.com/es/olddirectory/htmlpage.*
  http://www.olddomain.com/en/directory/htmlpage.* -
  http://www.newdomain.com/en/olddirectory/htmlpage.*
 http://www.newdomain.com/olddirectory/oldhtmlpage.*

 I'm sorry, but you confused me a lot, and now I'm not sure I
 understand what you need / want :-/

  Last question, the option 301 does it work with those redirects ?

 Yes, just add code 301 to the line.

 Regards,
 Willy




Redirection with 301 for all subdomains with exception

2009-06-22 Thread Falco SCHMUTZ
Hello everybody,
Could you help to fix this configuration ?

I need to redirect all sub domains except 5 (admin, pro, www, img*,
domain.com without sub domain) to www.domain.com

I test this setting, but did not work.

acl good_subs url_beg admin pro www img*
redirect location www.domain.com 301 if  !good_subs

I have no idea for http://domain.com to http://www.domain.com and i did not
know if img with wildcard work.

Thanks in advance

Falco


Re: Redirection with 301 for all subdomains with exception

2009-06-22 Thread Willy Tarreau
On Mon, Jun 22, 2009 at 08:32:36PM +0200, Falco SCHMUTZ wrote:
 Hello everybody,
 Could you help to fix this configuration ?
 
 I need to redirect all sub domains except 5 (admin, pro, www, img*,
 domain.com without sub domain) to www.domain.com
 
 I test this setting, but did not work.
 
 acl good_subs url_beg admin pro www img*
 redirect location www.domain.com 301 if  !good_subs

the host name is not in the url but in the Host: header. So you
must do that instead :

   acl good_subs hdr_beg(host) -i admin. pro. www. img

 I have no idea for http://domain.com to http://www.domain.com and i did not
 know if img with wildcard work.

You can do that :
   acl good_subs hdr_beg(host) -i admin. pro. www. img domain.com

For the wildcard you don't need anything special as hdr_reg() matches
at the beginning of the field. However if you need finer combinations,
check with the regexes. It will be harder to configure but with
infinite combinations.

Willy