.htaccess forwards to mydomain.com
By forward do you mean a visible redircet, or internally without the user knowing? If the domains point to subdirectories, you probably can't have an internal redircet.
I want to use a similar php script on my index page, so when a user hits :
ANYSUBDOMAIN.mydomain.com
Only for your index, what about ANYSUBDOMAIN.mydomain.com/stuff/here?
The subdomain's folders doesn´t exist, and i dont want to create them dynamically neither, i just want to know the name of the subdomain they are typing.
This might work, it depends on the server configuration:
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.DOMAIN$ [NC]
RewriteRule ^(.*)$ http://DOMAIN/index.php?sub=%1&uri=$1 [R=301,L]
But if you're getting a forbidden error, it might mean the subdomain's arn't setup in the main server configuration and then you need to ask GoDaddy about it. Ask them if they can point all your subdomains to your main document root.