Forum Moderators: phranque

Message Too Old, No Replies

Subdomains via htaccess

         

asantos

9:32 pm on Jan 31, 2007 (gmt 0)

10+ Year Member



Hi. Suppose i have 123456.com
There are several users, and each one has its own profile.

So, if my username is asantos, this url should be a shortcut for my profile:
[asantos.123456.com...]

Can this be achieved through htaccess?
Thanks,
Andres

christopherwoods

10:37 pm on Jan 31, 2007 (gmt 0)

10+ Year Member



Simplest way to do this is to set up (read: get your webhost to do this, if you don't have control of your httpd.conf) your virtualhost entry as a wildcard (so, instead of it listening for incoming requests to 123456.com, make it listen for *.123456.com). Once you have that set up, you can write PHP scripts or whatever to listen for variables before the domain, strip the vars out of the domain name with regexps or somesuch similar, and Robert's your mother's brother.

It ain't simple, and I never did get my own idea for a wildcard-based site finished (ran out of free time), but that's the first place to start.

Also see: [webmasterworld.com...]

asantos

3:18 pm on Feb 2, 2007 (gmt 0)

10+ Year Member



Hi,
actually i dont have access to my httpd.conf ... thats why im trying to achieve that through the .htaccess

jdMorgan

3:32 pm on Feb 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to make sure that these subdomains will actually be sent to your server first. If not, then httpd.conf access will be required, or perhaps you can get your host to do this for you. You cannot procedd until your server recognizes the subdomain and sends those requests to your 'account' filespace.

Once that is done, then for mapping those subdomains to subdirectories, this search [google.com] should help you get started.

Jim

asantos

2:32 pm on Feb 3, 2007 (gmt 0)

10+ Year Member



thanks!
ill try to talk to my hosting admin