Welcome! Log In Create A New Profile

Advanced

domain rewrite/redirect

May 02, 2011 06:35PM
I have two different domains. One is a shortened url for referrals. I want to be able redirect the host name from the short url with parameters to the actual url. For example:

abcd.com/123456

rewrite/redirect to

efgh.com/referrals/123456

Initially I used a CNAME setup for adbcd.com to rewrite to efgh.com but that doesn't rewrite the domain name or url.

Here's a short version of my setup with the rewrite rules I'm trying to use:

http {
server {
listen 80;
server_name abcd.com efgh.com;
rewrite ^(.*) https://$host$1 permanent;
}

server {
listen 443;
server_name abcd.com efgh.com;
if ($host ~* ^(efgh\.com)$ ) {
rewrite ^/(.*)$ https://abcd.com/referrals/$ redirect;
}
}
}

The url on the user's browser after entering https://efgh.com/123456 should appear as https://abcd.com/referrals/123456. Currently, it's just rewriting.
Subject Author Posted

domain rewrite/redirect

chiefops May 02, 2011 06:35PM

Re: domain rewrite/redirect

chiefops May 02, 2011 07:05PM

Re: domain rewrite/redirect

chiefops May 02, 2011 07:55PM

Re: domain rewrite/redirect

Cedric Jeanneret May 03, 2011 03:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready