Redirecting subdomains


#1

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


#2

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!


dino
Use Promo Code [color=#CC0000]DINOBARGAIN[/color] for [color=#00CC00]$50[/color] off most plans!


#3

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 ?


#4

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.


dino
Use Promo Code [color=#CC0000]DINOBARGAIN[/color] for [color=#00CC00]$50[/color] off most plans!


#5

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


#6

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


#7

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 ?


#8

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