MrXander Posted December 5, 2007 Share Posted December 5, 2007 Hi there, I'm currently looking to do something on my new website. Once a user signs up, I want them to be able to instantly go to theirname.mywebsite.com... is there any tutorials around that will help me do this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 I see two things you have to do. One is make a folder where their files reside. Two is modify the .htaccess file to point requests to their folder. Quote Link to comment Share on other sites More sharing options...
MrXander Posted December 5, 2007 Author Share Posted December 5, 2007 Alright... any idea how I can go about doing that? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 You'll need to learn how to work with Files and creating sub folders. Should be able to find tutorials on each Quote Link to comment Share on other sites More sharing options...
MrXander Posted December 5, 2007 Author Share Posted December 5, 2007 I know how to make files and folders, and could very easily make it mywebsite.com/theirname, but I want subdomains :\ Quote Link to comment Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 .htaccess does that for you so you can go to myfolder.domain.com Quote Link to comment Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 Looks like someone already made a script to do it all http://www.webdesignhq.com/sitebuilder/manual/sub_readme.html Quote Link to comment Share on other sites More sharing options...
runnerjp Posted December 5, 2007 Share Posted December 5, 2007 why not do it so its like.. mywebsite.com/myname RewriteEngine on RewriteBase / RewriteRule ^([^/.]+)/?$ /nameofpage.php?username=$1 Quote Link to comment Share on other sites More sharing options...
trq Posted December 5, 2007 Share Posted December 5, 2007 Doing this really depends on exactly what you want viewed when a user type http://username.yoursite.com. If its a case of a simple user profile, your rule might look like.... RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com RewriteRule ^/(.*)$ viewprofile.php$1 [L] Then in viewprofile.php (which is actually in your root directory)you would run a query based on the username passed via $_GET. eg; <?php if (isset($_GET['user'])) { $username = mysql_real_escape_string($_GET['user']); $sql = "SELECT * FROM users WHERE username = '$username'"; // execute the query and display the users profile. } ?> Hope this helps some. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.