joer80 Posted February 10, 2016 Share Posted February 10, 2016 I think I might have found a bug in thedefault processwire .htaccess file. # ----------------------------------------------------------------------------------------------- # OPTIONAL: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] It is common to need to preform a redirect like this to send non www users to a www address, so we include this code snippet in the default file that just needs to be enabled. It works great for domainname.com -> www.domainname.com, but the issue is it does not work for subdomains. We need to add code that does not forward a subdomain like test.domain.com to www.test.domain.com. Let me know if this is an easy fix! I could use it for the multi website project I am working on since the module only works on the www version. Thanks! Link to comment Share on other sites More sharing options...
joer80 Posted February 10, 2016 Author Share Posted February 10, 2016 For now this will correctly ignore subdomains but you must know the name of the sub domain. There is probably a way to make it work without typing it in: RewriteCond %{HTTP_HOST} !^(www|subdomainhere)\. [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 11, 2016 Share Posted February 11, 2016 That's not that simple as the regex does not have any knowledge about any domain level specifics. I'm not sure if there's any way to hit "myenglishdomain.co.uk", but not "subdomain.domain.com" other than having different regex formulas for both. # First Level Domain (e.g. *.com) !^(www)\.([^\.]+)\.([^\.]+)$ # Second Level Domain (e.g. *.co.uk) !^(www)\.([^\.]+)\.([^\.]+)\.([^\.]+)$ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now