Hani Posted July 18, 2013 Share Posted July 18, 2013 I've enabled the redirect in .htaccess that will add www. to the URL if someone visits the site without it. However, it seems like the redirect does not take into consideration urlSegments and simply ignores them. For example, if someone goes to http://mydomain.com/section/urlSegment1/ They are redirected to http://www.mydomain.com/section/ The section in the .htacess that was enabled are these two lines RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Anyone have any thoughts or a solution? I'm an amateur when it comes to .htaccess. Link to comment Share on other sites More sharing options...
Alessio Dal Bianco Posted July 18, 2013 Share Posted July 18, 2013 Hi Hani, Try this: RewriteBase / RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.+) http://www.mydomain.com/$1 [L,R=301] Link to comment Share on other sites More sharing options...
Hani Posted July 18, 2013 Author Share Posted July 18, 2013 Thanks, Alessio. However, that didn't seem to fix the issue I'm experiencing. It still seems to behave in the same manner. I suppose I should also ask, is anyone else able to confirm that this happens for them too? Or is this unique to my setup? My "section" page is set to allow URL segments of course. Link to comment Share on other sites More sharing options...
Alessio Dal Bianco Posted July 18, 2013 Share Posted July 18, 2013 I have used many times URL segments with no problems. What version of PW are you using ? Try to look with the web inspector if there are two redirects or one. I think if there is one redirect is an .htaccess problem; 2 (maybe) PW problems. Link to comment Share on other sites More sharing options...
ryan Posted July 20, 2013 Share Posted July 20, 2013 I'm not really sure what could be causing that. Apache and .htaccess know nothing about URL segments... that is only a ProcessWire term. To Apache/.htaccess those URL segments are just a part of the REQUEST_URI like anything else. I would comment out that directive in your .htaccess and look elsewhere (in your .htaccess and in your PW templates) to see where the redirect might be coming from. 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