I have a full-blown site like:
http://www.example.com (uses index.php)
http://www.example.com/scriptA.php
http://www.example.com/scriptB.php
I now want to have the possibility of setting up subsites like:
http://alpha.example.com
http://alpha.example.com/scriptA.php
http://alpha.example.com/scriptB.php
From https://stackoverflow.com/questions/2844004/subdomain-url-rewriting-and-web-apps/2844033#2844033 , I understand that I have to do:
RewriteCond %{HTTP_HOST} ^([^./]+)\.example\.com$
RewriteCond %1 !=www
RewriteRule ^ index.php?domain=%1
But what about the other scripts like scriptA and scriptB? How do I tell httpd.conf to handle those properly as well?
How can I tell httpd.conf that handle everything after the 'forwardslash', exactly as it does on the main site, but pass a parameter flag like
&domain=alpha
EDIT1
...
I have lots of these subdomains being used, but I placed them _before_ the main 'www' one.
...
<VirtualHost IPADDRESS:80>
ServerAlias test4.example.com
ServerAdmin me@me.com
DocumentRoot /home/test4/public_html
ServerName test4.example.com
UseCanonicalName On
</VirtualHost>
<VirtualHost IPADDRESS:80>
ServerAlias *.example.com
ServerAdmin me@me.com
DocumentRoot /var/www/html/beta
ServerName example.com
UseCanonicalName On
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /opt/GeoLiteCity.dat IndexCache
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$ [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ http://www.example.com%{REQUEST_URI}?domain=%1 [L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$ [NC]
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^(.*)$ http://www.example.com%{REQUEST_URI}?%{QUERY_STRING}&domain=%1 [L]