Redirect mydomain.com to www.mydomain.com

4 posts / 0 new
Last post
#1 Mon, 10/17/2011 - 14:05
tpnsolutions
tpnsolutions's picture

Redirect mydomain.com to www.mydomain.com

Hi,

Aside from adding a .htaccess file to force redirection, is there any Virtualmin feature allowing for "mydomain.com" to auto redirect to "www.mydomain.com"?

-Peter

Mon, 10/17/2011 - 14:10
andreychek

Howdy,

If you'd like to do a redirect like that, the best way would be through using a .htaccess file.

-Eric

Mon, 10/17/2011 - 14:57 (Reply to #2)
tpnsolutions
tpnsolutions's picture

Eric,

Was sort of hoping some feature was available through Virtualmin as doing the .htaccess method could become super time consuming as I need to redirect a few hundred domains in this manner.

The reason for this change is I'm going to be making use of "CloudFlare" as a "hosting provider" where traffic is filtered for "subdomains" and unfortunately not domains directly.

This is because CloudFlare makes use of my own DNS servers where "subdomains" are setup as CNAME's to their backend, and routed accordingly.

-Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Mon, 10/17/2011 - 16:54
tpnsolutions
tpnsolutions's picture

Hi,

I found a viable solution which seems to work, but will still require some time to implement.

Basically, I'm going to add a global Rewrite Rule to the Apache configuration file for each domain.

This rule will cause all "mydomain.com" variations to automatically do a "301" redirect to "www.mydomain.com" versions.

Based on the simple concept, all "subdomain.mydomain.com" will also redirect to "www.subdomain.mydomain.com" versions too.

I am also adding this ruleset to Virtualmin's template so that when new domains are created, the rule it automatically implemented.

-Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Topic locked