Redirect haproxy from url to another keeping this same path/uri - haproxy

I want to redirect as the below examples, keep the same path/uri but change the url.
https://test1.com/example1/example2 --> https://test2.com/example1/example2
I managed to do it for the url only by creating an acl acl_name base url and then do a redirect code 301 with an if conidtion.
Thanks,

Related

Is it possible to get a reference to the vanity URL used after redirection?

I have a page http://localhost:4502/content/project/en/mypage.html and it has couple of vanity URLs set as
/content/project/vanity-1
/content/project/vanity-2
So any request from the above two vanity URLs are being redirected to /mypage.html.
Is it possible to get the vanity URL request from where the page is redirected to? i.e how can I find from which vanity URL the request is coming from?
request.getRequestURL() gives me ../mypage.html but I need to get the vanity URL request.
You should try to get it from /content/project/page/jcr:content properties sling:vanityPath
It's available in the HTTP referer header. You can get it as follows:
String referrer = request.getHeader("referer");

server side redirect in classic ASP on IIS7

I'm trying to implement a simple 301 redirect from mydomain.com/page1.asp to mydomain.com/page2.asp. These are dynamically generated product pages of an ecommerce store, so they don't physically exist as files.
In Apache it's simple to do with .htaccess but all I found are ways to redirect static pages, that actually exist on the server, such as placing the code below in at the top of the existent file:
<%#LANGUAGE="VBSCRIPT"%>
<%
' Redirect to the new location with the correct 301 Moved Permanently status
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/new-page.php"
%>
Is there a way to redirect a dynamically generated page in IIS7 using classic asp?
UPDATE
Based on the comments received, I need an URL rewrite module. #ZippyV suggested this one
You want to rewrite your URL requests instead of redirecting them.
IIS has a URL Rewrite module which you can download here. Another nice feature is that it can transform your outgoing html too.
More articles on how to use the IIS URL Rewrite Module: http://www.iis.net/learn/extensions/url-rewrite-module

301 URL Redirect with arguments without htaccess or php

How do I redirect http://olddomain.com/page to http://newdomain.com/page
The old domain is using namecheap's dns. Currently, I have setup a 301 URL redirect on olddomain.com and www.olddomain.com to www.newdomain.com. However, visiting olddomain.com/page takes me to www.newdomain.com instead of www.newdomain.com/page.
Is there a way to do it without using htaccess or php?
use webmaster tool. Thats is easy. We normaly use server side programming, ip redirect. But that is very easy and convenient.

Redirect 301 Not Working Fine

I'm trying to do a simple Redirect 301 but I'm experiencing an issue in this case:
This is my redirect:
Redirect 301 /negocios/wisconsin/wi/ www.domain.com/directorio/category/121/Wisconsin.html
When I enter this URL:
www.domain.com/negocios/wisconsin/wi/servicios-multiples/
It applies the Redirect rule and sends the browser to this URL:
www.domain.com/directorio/category/121/Wisconsin.htmlservicios-multiples/
Which is a WRONG url. Probably because a part of the URL (/negocios/wisconsin/wi/) is similar to the URL I'm trying to redirect.
How I can do to apply the Redirect ONLY to this URL (/negocios/wisconsin/wi/) even if I enter another URL similar like for example
www.domain.com/negocios/wisconsin/wi/WHATEVER-HERE
Try using a RedirectMatch instead:
RedirectMatch 301 ^/negocios/wisconsin/wi/$ www.domain.com/directorio/category/121/Wisconsin.html
This tells apache only to redirect on the exact match instead of linking path nodes together, which is what Redirect does.

Resolve Proper URL

How can I turn domain.com into https://www.domain.com (the actual address)? Is there an easy API for this?
The purpose is to allow a user to enter a domain in preferences and allow my app to convert that into a fully qualified web URL like a web browser does when I type google.com it returns http://www.google.com (ish).
If typing your domain.com results in https://www.your domain.com then the server is redirecting. Here is a rule to follow:
Construct "https://domain the user typed". Connect to that, and follow any 301 (permanent) redirects until you get a 200 response. Save the URL you end up at as the permanent one.
If your connection failed, try again with http:// instead of https://.
Do not assume that the "proper" URL contains "www."; if it should, then the server will redirect.
What's so hard about putting "http://www." in front?
How does that require an API?
Are you asking about the string concatenation API?
Use the NSURL class. More specifically, use initWithScheme:host:path where scheme is "http", host is your string and path is empty.