Forum Moderators: phranque
the non www version of a site
ie: example.com and the www version ie: www.example.com
I've seen the sample code discussed here for how to do that in each individual htaccess file, but is there something that can be done system wide in the httpd.conf file on the server so that all domains will be redirected to their respective www versions?
I'm not very technical, so hopefully this has not been asked before. Did a seach here first but could only find samples of the modifying htaccess so thought I would ask some of the real experts here if there was a better, more efficient way of doing this without having to go in and fix each htaccess file manually and/or to change each htaccess file after site/s are created. Any suggestions would be very appreciated.
Thanks!
So far if I go in and manually change the htaccess code for the main/root directory than my redirect works, but if I try the same thing in a subdirectory
ie:
mysite.com/foldername
than I am getting all kinds of loops when trying to fix the www vs non www page issue. There are many subfolders on the sites and I was hoping not to have to manually go in and change each htaccess file, not to mention my "loop" problem when I do.
Anyone have any suggestions on how they deal with this? thanks again
The code you typically see posted here for redirecting www to non-www or vice-versa, should work if placed in the Web root .htaccess file. Most versions will work with a small modification if placed in the httpd.conf server config file.
You should not have to repeat the code in multiple .htaccess files in multiple subdirectories of the same site or domain. If you are finding that you need to do this, then your server configuration is either incorrect or 'very atypical.'
Jim