I am hosting multiple domains so when I setup a wildcard it always points to the root
I'm assuming you meant that you get the same content for example.domain.com
as if you were visiting www.domain.com
. This can surely be handled through htaccess
rewrite rules.
If a sub-domain named subsite
was to be served out of ${DOCUMENT_ROOT}/subsite
directory, you would add the following rules to your .htaccess
placed at your web root /
directory:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^subsite\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subsite [NC]
RewriteRule ^(.*)$ /subsite/$1 [L]
If there are several mutisite subdomains that need redirection, use the following dynamic rules instead:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\1
RewriteRule ^(.*)$ /%1/$1 [L]
You would also need to add ServerAlias *.domain.com
to your <VirtualHost>
configuration in Apache's httpd.conf
file.
It seems BlueHost doesn't take up any requests to modify
httpd.conf
directly for you. But, they do provide a way to setup a wildcard subdomain from their Control Panel.
Take a look at How to Set Up a WordPress MultiSite in Bluehost. The last section outlines the process with screen shots. You also need to enable theme per site for your subdomains.