redirecting subdomains

redirecting subdomains

Posted by: mistermonty
Posted on: 2006-05-09 11:27:00

Hello,


I have setup my site so that every user has a page like this:

http://www.domain.com/userinfo.php?user=user1
http://www.domain.com/userinfo.php?user=user2
http://www.domain.com/userinfo.php?user=user3

Now i would like to give each user its own subdomain like this:
http://user1.domain.com
http://user2.domain.com
http://user3.domain.com

and so on ...
What is the best way to do this ? Do I need to manually make a subdomain for each user and redirect it to the userinfo php page? Or is there a better solution for this ?

Greetings

MM

Re: redirecting subdomains

Posted by: dino
Posted on: 2006-05-10 07:47:00

Hey,

This is pretty easy from the Control Panel:

Domains > Manage Domains > Add New Domain / Sub-Domain

The just fill out the name of the subdomain you want to create and what directory you want to point it at in the "Fully Hosted" section.

You can also choose to park, redirect, mirror or cloak sub-domains as well, depending upon your users needs.

Good Luck!

Re: redirecting subdomains

Posted by: mistermonty
Posted on: 2006-05-10 07:57:00

Hey,

I want to point it to a php page with a parameter instead of a folder.
How should i enter this in the "fully hosted" section ?

Re: redirecting subdomains

Posted by: dino
Posted on: 2006-05-10 07:57:00

Whoops,

I just realised you probably already know how to do that and you're wanting to redirect to a particular PHP file.

Personally I'd have a .htaccess file to handle this.

Do some googling for "mod rewrite subdomain" or similar and you should find something. Or zap me back if you can't and I'll think of something or other.

Re: redirecting subdomains

Posted by: mistermonty
Posted on: 2006-05-12 13:57:00

Hey Dino,

thanks for your reply.
I have no experience with editing htaccess file. And all samples i find are just to redirect a subdomain to another domain.
Do you have a code snippet with a sample subdomain that gets redirected to a php page ?


Greetings

Re: redirecting subdomains

Posted by: dtobias
Posted on: 2006-05-17 08:57:00

If you pick "redirect" instead of "fully hosted", you can give it a complete URL to redirect to. No fiddling-by-hand with .htacess files is needed, though advanced users can do more sophisticated conditional redirections that way.

-- Dan

Re: redirecting subdomains

Posted by: mistermonty
Posted on: 2006-05-18 08:06:00

Yes that is possible, but than when the subdomain is entered, the url in the browser changes. Is it possible to redirect, but just show the subdomain that is entered instead of the redirected domain ?

Re: redirecting subdomains

Posted by: dtobias
Posted on: 2006-05-23 16:19:00

I think they've got a "cloaked" feature that uses frames to do this, but it's not something I recommend. If you want the subdomain to stay in the URL bar, you're best off fully-hosting the subdomains instead of redirecting them, and actually putting the users' pages in the respective subdomains instead of as pages in the main domain that need to be redirected to.

-- Dan

Tags: www domainphpredirectingsubdomaingreetingshttpsubdomainsredirect