joebaich Posted July 16, 2015 Share Posted July 16, 2015 This part of the htaccess file in the current (and previous) PW distributions also rewrites, for me anyway, anything.mydomain.com as www.anything.mydomain.com # ----------------------------------------------------------------------------------------------- # OPTIONAL: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Link to comment Share on other sites More sharing options...
Mike Rockett Posted July 16, 2015 Share Posted July 16, 2015 It's disabled by default anyway - it is doing what it's supposed to do. Only enable it if you want it. Link to comment Share on other sites More sharing options...
joebaich Posted July 20, 2015 Author Share Posted July 20, 2015 With respect, it may be doing what it's meant to do but it's also doing what it's not meant to do - by that I mean according to a literal interpretation of the preceding comments in that section of the file. Certainly http://mydomain.com/ would be redirected to http://www.mydomain.com. I wanted it to do that. What I didn't want it to do is redirect http://cdn.mydomain.com to http://www.cdn.mydomain.com which it did too. It took me hours to work out that this was what was causing my first ProCache CDN integration to fall over. Like most problems, easy enough to fix once one has identified it but a pain in the rear until then. Only a word or two more about the impact on sub domains would help and explaining that one can exclude them from the rewrite by adding them to the condition e.g. RewriteCond %{HTTP_HOST} !^(www|sub1|sub2)\.[NC] 2 Link to comment Share on other sites More sharing options...
Macrura Posted July 20, 2015 Share Posted July 20, 2015 @joebaich - i've been (slightly) stung by this also at some point; your fix is appreciated - i often need to redirect the main site to www, but at the same time have a subdomain like dev but don't want that www prepended.. Link to comment Share on other sites More sharing options...
Mike Rockett Posted July 22, 2015 Share Posted July 22, 2015 A better approach would be to do this: RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] So, only force the prefix if we're accessing http://example.com/. 1 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