Jump to content

Recommended Posts

I found this on another forum:

 

What you can do is add a new wildcard subdomain. You can do this with DNS management like the tutorial I linked to below tells you to, but if you do not have access to your DNS management you can just add a new subdomain in your cpanel. To make it wildcard just add *.yourdomain.com. After doing this give the server some time to update, but if you did it right any subdomain you go to should return the same output as your root domain name (i.e. your index page).

 

After you add *.yourdomain.com create the .htaccess file below, and then all you have to do is have php make new directories in your root folder with the dynamic subdomain you want.

 

This code should be placed in the htaccess file in the root of your domain, i.e. domain.com/.htaccess

 

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
   RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
   RewriteRule (.*) %2/$1 [L]
</IfModule>

 

Source

yeah i know but i was wondering what are the necessary files that need to be configured for this and if its possible for a php script to access it.

 

reason is im trying to start a website in php where people register an account and they get a subdomain like http://myaccount.myspace.com/ for example

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.