I'm using dynamic subdomains and have the default index setup at the moment but I'm struggling getting it to find other files within the directory? http://domain.com/user.php?username=bob is now http://bob.domain.com But how can I change my .htaccess so that http://domain.com/newpost.php is http://bob.domain.com/new Here is my current htaccess that doesn't do what I want? Options -indexes +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.domain\.com RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com RewriteCond %{REQUEST_URI} !^/user\.php$ RewriteCond %{QUERY_STRING} !^username=. RewriteRule ^(.*) user.php?username=%1 [L] RewriteRule ^new$ /newpost.php [L] Code (markup):
I've had a problem doing the same thing a little while ago on one of my projects. I ended up using a wildcard subdomain. A wildcard is good because it will use "whatever.domain.com" and use the same directory as "domain.com", same goes for "whatever.domain.com/script.php" it would be pulling from your public_html directory the script.php and would still be able to parse all of the variables. To set up a wildcard dns entry in cpanel just add a new subdomain as *.domain.com (yes, use the asterisk). Best of luck, Bryan