Welcome! Log In Create A New Profile

Advanced

Redirect domains to subdomains...

Posted by Andrea 
Redirect domains to subdomains...
June 29, 2009 08:40AM
Hello, i hope someone can help me:

In my applications i have a subdomains for each of my clients, like this:

client1.myapp.com
client2.myapp.com
client3.myapp.com
etc etc

Now, i want to associate the subdomains that my clients have on my application to their main domain (if they have one) for example:
if a client have a domain like www.client1domain.com i want to redirect it to clent1.myapp.com
www.client2domain.com to clent2.myapp.com
www.client3domain.com to clent3.myapp.com

Using rewrite rules i can redirect them to my subdomain, but in the browser instead of client1.myapp.com i want to show their main domain, how can do that? It's this even possible?

Thanks



Edited 1 time(s). Last edit at 06/29/2009 08:40AM by Andrea.
Re: Redirect domains to subdomains...
June 29, 2009 02:51PM
Andrea Wrote:
-------------------------------------------------------
> Hello, i hope someone can help me:
>
> In my applications i have a subdomains for each of
> my clients, like this:
>
> client1.myapp.com
> client2.myapp.com
> client3.myapp.com
> etc etc
>
> Now, i want to associate the subdomains that my
> clients have on my application to their main
> domain (if they have one) for example:
> if a client have a domain like
> www.client1domain.com i want to redirect it to
> clent1.myapp.com
> www.client2domain.com to clent2.myapp.com
> www.client3domain.com to clent3.myapp.com
>
> Using rewrite rules i can redirect them to my
> subdomain, but in the browser instead of
> client1.myapp.com i want to show their main
> domain, how can do that? It's this even possible?
>
> Thanks

Hi Andrea,

If I understand correctly you want to rewrite client1.myapp.com to client1domain.com.

If so, try:

[code]
server {
server_name client1.myapp.com;
root /path/to/doc/root;
index index.html; #or whatever your index file is
rewrite ^ http://client1domain.com$request_uri? permanent;
}
[/code]

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 131
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready