There's an response to the question of handling wild card subdomains, but it doesn't meet my needs. I have to do many of these, assuming for instance the domain is

  1. When the domain given is world wide it will 301 redirect to because I don't want to possess duplicate content and build problems in search engines like google.

  2. When the domain is it will quietly redirect to to ensure that software can select up what subdomain was asked for and act accordingly.

  3. Additionally, any specs following the domain title that doesn't make reference to a real file or directory ought to be rerouted to index.php (again the program will evaluate which everything meant). So should redirect to

I'm able to get areas of this to operate, but haven't yet attain the whole factor. Any offers!

Try these rules:

# 1. rule
RewriteCond %{HTTP_HOST}
RewriteCond %{HTTPS} ^on(s)|
RewriteRule ^ http%1://{REQUEST_URI} [L,R=301]

# 2. rule
RewriteCond %{HTTP_HOST} ^([^/.]+)\.example\.com$
RewriteRule ^ /absolute/filesystem/path/to/{REQUEST_FILENAME} [L]

# 3. rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]