TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-09-2009, 01:47 PM   #1 (permalink)
The Visitor
 
Join Date: Apr 2009
Posts: 2
Thanks: 0
ian ditch is on a distinguished road
Default myusername.mywebsite.com

hi people. my 1st post.

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

thanks
ian ditch is offline  
Reply With Quote
Old 04-09-2009, 02:06 PM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Are you just asking what a subdomain is, or are you looking to make it dynamic? If you are looking to make it dynamic, mod_rewrite is probably your best option.
__________________

Village Idiot is offline  
Reply With Quote
Old 04-09-2009, 04:50 PM   #3 (permalink)
The Visitor
 
Join Date: Apr 2009
Posts: 2
Thanks: 0
ian ditch is on a distinguished road
Default

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?
ian ditch is offline  
Reply With Quote
Old 04-09-2009, 05:52 PM   #4 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I believe PHP has nothing to do with the subdomains. That's something you have to ask your webhost provider.
__________________
Tanax is offline  
Reply With Quote
Old 04-09-2009, 08:35 PM   #5 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
I believe PHP has nothing to do with the subdomains. That's something you have to ask your webhost provider.
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...
allworknoplay is offline  
Reply With Quote
Old 04-10-2009, 04:13 AM   #6 (permalink)
The Visitor
 
anees_muhd's Avatar
 
Join Date: Jan 2009
Posts: 4
Thanks: 1
anees_muhd is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
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...
Yes..
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...

Regards
Anees
anees_muhd is offline  
Reply With Quote
Old 04-10-2009, 04:34 AM   #7 (permalink)
The Contributor
 
jcorradino's Avatar
 
Join Date: Sep 2008
Posts: 36
Thanks: 2
jcorradino is on a distinguished road
Default

you could always try a rewrite rule

RewriteRule http://(.*).yoururl.com http://www.yoururl.com/username=$1

just set your httpd.conf file as so (if it is your server, if not, your host can most likely set it up for you):

<VirtualHost *:80>
DocumentRoot "/path/to/www/"
ServerName *.yoururl.com
</VirtualHost>

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):

RewriteRule yoururl.com/(.*) yoururl.com/user.php?username=$1

dont forget RewriteEngine on and Options +FollowSymLinks though!
__________________
Jason Corradino
Applications Developer, Interactive Support - Tribune Technology
J2EE Development, Script Tinkering - Develop, Support, and Maintain Tribune websites.
jcorradino is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:03 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design