Dynamic Subdomains

Dynamic Subdomains

Posted by: The
Posted on: 2007-12-21 08:56:00

OK, I messaged DH, and asked for wildcard DNS to be turned on, and thus in return, they turned it on for me.

I am using this code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.hostbox.us [NC]
RewriteCond %{HTTP_HOST} ^([a-z0-9]+).hostbox.us
RewriteRule (.*) viewFile.php?user=%1 [L,QSA]


to take the subdomain, pass it to the viewFile.php file, so it can read in the actual file, and print it on the page.

The problem I am having is that I am getting Server not found error.

Any help on this would be greatly appreciated!

Re: Dynamic Subdomains

Posted by: Lensman
Posted on: 2007-12-21 09:21:00

When did the wildcard entry get added to your domain? It may take a while for DNS to propagate...

Re: Dynamic Subdomains

Posted by: The
Posted on: 2007-12-21 09:24:00

about 2 hours ago.

It worked for them they said, but now they are fixing my .htaccess files, so it will work.

I hope it works correct when it is done.

Re: Dynamic Subdomains

Posted by: The
Posted on: 2007-12-21 10:06:00

OK, they could only get half of it, so I have modified what was done, to work slightly better.

In reply to:

RewriteEngine On

Options -MultiViews

#RewriteCond %{REQUEST_URI}!^/sd_
#RewriteCond %{HTTP_HOST}!^www.hostbox.us [NC]
#RewriteCond %{HTTP_HOST} ^([^.]+).hostbox.us
#RewriteRule (.*) /sd_%1/$1 [L]
RewriteCond %{HTTP_HOST} !^www.hostbox.us
RewriteCond %{HTTP_HOST} ([^.]+).hostbox.us [NC]
Options +FollowSymlinks
RewriteRule ^http://(.*).hostbox.us$ http://hostbox.us/viewFile.php?user=$1 [L,R]


That works almost, It takes me to the correct directory, but it doesn't open viewFile.php, just a tree structure.

Tags: subdomainssubdomain