Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
Created July 17, 2013 18:27
Show Gist options
  • Save ursuleacv/6023125 to your computer and use it in GitHub Desktop.
Save ursuleacv/6023125 to your computer and use it in GitHub Desktop.
How to let PHP to create subdomain automatically for each user?
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([aA-zZ])$ dostuff.php?username=$1
The rewrite rule for grabbing the subdomain would look like this:
RewriteCond %{HTTP_HOST} ^(^.*)\.mywebsite.com
RewriteRule (.*) dostuff.php?username=%1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment