I've noticed that it is possible to have a varible before your site address, e.g. myusername.mywebsite.com
can anyone cast light on how to do this or what this is called so i can google it. I want to get away from using mywebsite.com/myusername and creating a seperate folder for each member in my root directory
ha, right, its subdomains that i want.
after googleing this i realise i'm stepping into another minefield here.
all i'm after doing is to create a subdomain of 'username' instead of '/username' for a members area.
i would normally simply use mkdir("username", 0700) etc to make
a unique folder for each member (mainly for their images)but this fills the root directory full of folders so instead i'm looking at maybe using these subdomains?
is there a quick & simple way of using php to create a subdomian
and if so, what would the path to the image be?
Correct, this is not a PHP thing or any kind of variable thing.
What you are looking to do is create a subdomain.
that has to do with your hosting provider and DNS.
Where you store your directory "username" doesn't matter, as long as your provider is aware of it and your web server is configured to know that that directory is meant to be a subdomain...
But if you are lucky you can do it easily
Some of the providers will give catch all subdomain facility.
but some are not
in the first case we can logically manage the problem
that is you are not going to be create any subdomains, instead you will catch any string that comes in front of your domain and will manage with your file and treat them as usernames
So that you can check with your DB and perform appropriate actions...
dont hold me to it though, I have not messed around with Apache in a while, so I am bound to be a bit rusty.
If it does work, it will actually just see your "subdomain" as the php get variable username, in which case, you can just ignore www. Otherwise, you can always stick with the following (which I know works like a charm):