I have shared hosting from GoDaddy. I want to create(illusion) sub-domains dynamically from URL parameters.
For e.g. http://example.mydomain.com/value1/value2
points to
http://www.mydomain.com/?domain=example&m1=value1&m2=value2
I have created A wildcard DNS record. I also have added these rules in .htaccess
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain.com RewriteCond %{HTTP_HOST} ^(.+).mydomain.com RewriteRule ^([^/]*)$ http://www.mydomain.com/index.php?domain=%1&m1=$1&m2=$2 [P,L]
But when I open http://example.mydomain.com I get "pageok" as output.
Please help. Thanks in advance.
If you are on shared hosting with GoDaddy, it’s probable they are only configuring their Apache install to pay attention to www.mydomain.com
and mydomain.com
and nothing else via NameVirtualHost
. You would have to see if it’s possible for them to accept any subdomain sent to [subdomian].mydomain.com
and then send it to the main site script.