Forum Moderators: phranque
I Have wildcard DNS enabled on my server and i am using the following htaccess rules
RewriteEngine On
RewriteCond %{HTTP_HOST}__SPACE__!^$
RewriteCond %{HTTP_HOST}__SPACE__!^(www\.)?mydomain\.com$ [NC]
RewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([^.]+).*<->/([^/]+) [NC]
RewriteCond %2<->%3__SPACE__!^(.*)<->\1$ [NC]
RewriteRule ^(.+) /%2/$1 [L]
Now the problems is really strange.The site had many pre existing subdomains. but after using the above htaccess rules some sub domains started to work while others did not work.They started giving ERROR 500.i don't know why?
the sub domains which worked are of blogs.subdomain.com
and forums.subdomain.com
and all other subdomains did not work.even if i create new sub domains from my cpanel console, the new subdomain do not work and they start giving error 500.
Moreover sub domains are not using contents of the respective folders.
You have replaced _SPACE_ with a literal space character, right?
And you have verified with your host that your server supports POSIX 1003.2 regular expressions or later? Not all server OSes support these regular expressions, and if yours does not, then this code won't ever work on it.
Jim
This is the likely cause of your "some subdomains work, some don't" problem. You will either need to use the same subdomain-to-subdirectory mapping method that your control panel used when setting up "blog" and "forum" or you will need to add exceptions to httpd.conf and/or .htaccess so that the configuration code sections don't interfere with each other.
So much depends on exactly what code your control panel "wrote" in httpd.conf to define the subdomains that I wouldn't even care to guess at the details of what you'll need to do. You might want to try to get *one* additional subdomain working first (in addition to "blogs" and "forums") and then take the next step to a full "wild-card" setup.
Jim
if i do not use the above htaccess rules then all the subdomains point to the root directory,this means that wildcard dns has been installed correctly.
once i use those codes all the subdomains shows me error 500 except blogs and forums sub domain.I tried checking access logs and error logs but to no avail.
In the meantime,i emailed host to show me what they have done in httpd.conf. once i get that info i will post here too.
please have a look
================================================
NameVirtualHost ip.ip.ip.ip:80
ServerAlias www.mydomain.com *.mydomain.com => Entry for wildcard dns
ServerAdmin webmaster@mydomain.com
DocumentRoot /home/cpanelusername/public_html
UserDir disabled
UserDir enabled cpanelusername
ServerName mydomain.com
suPHP_UserGroup cpanelusername cpanelusername
User cpanelusername
Group cpanelusername
BytesLog /usr/local/apache/domlogs/mydomain.com-bytes_log
CustomLog /usr/local/apache/domlogs/mydomain.com combined
ScriptAlias /cgi-bin/ /home/cpanelusername/public_html/cgi-bin/
=========================================================