HAProxy community

Redirect 301 without loosing URI


#1

Hello,

I have create a redirect from wiki.charlot.com to wiki.ca.com via the below syntax. The problem which now I am looking at is if a user access wiki.charlot.com/display/test it will be redirected to wiki.ca.com and not to wiki.ca.com/display/test. Thus I am loosing the URI path.

For the redirection I have created an acl

acl wiki_acl_redirect hdr_reg(host) -i ^wiki.(charlot).com$

Then I have used the redirect list below
redirect code 301 location https://wiki.ca.com/ if wiki_acl_redirect

Thankyou and appreciate your help


#2

Use redirect prefix instead:

redirect code 301 prefix https://wiki.ca.com if wiki_acl_redirect


#3

Worked thanks a lot @lukastribus