Digital Cipher Posted November 10, 2008 Share Posted November 10, 2008 Hi allHas anyone found the reason and a solution to why i have to use www. in front of my site url, two problems i have found are you cannot login to the back office and the cart looses the contents when you select another product or re fresh my browser.Browsers = IE7 & FF3 (Opera works fine)Apache/2.2.3 (CentOS) PHP Version 5.1.6MySQL 5Host = Easyspace.comCan anyone help Link to comment Share on other sites More sharing options...
jhnstcks Posted November 10, 2008 Share Posted November 10, 2008 Add the followin code to your .htaccess file. replacing example.com with your domain name.It will redirect anyone without the www prefix to the address using www. Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^example.com[nc] rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc] Link to comment Share on other sites More sharing options...
Digital Cipher Posted November 10, 2008 Author Share Posted November 10, 2008 I added the following code and still the same, it does not redirectOptions +FollowSymlinksRewriteEngine onrewritecond %{http_host} ^woods-furniture.co.uk[nc]rewriterule ^(.*)$ http://www.woods-furniture.co.uk/$1 [r=301,nc] Link to comment Share on other sites More sharing options...
jhnstcks Posted November 10, 2008 Share Posted November 10, 2008 Well it works on 2 of my sites, so no idea why it doesnt work on yours. Link to comment Share on other sites More sharing options...
Paul C Posted November 10, 2008 Share Posted November 10, 2008 I added the following code and still the same, it does not redirectOptions +FollowSymlinksRewriteEngine onrewritecond %{http_host} ^woods-furniture.co.uk[nc]rewriterule ^(.*)$ http://www.woods-furniture.co.uk/$1 [r=301,nc] There are two possible reasons I can think of, one easy to fix and the other... not.1) Try changing the above code to: Options +FollowSymlinks RewriteEngine on rewritecond %{HTTP_HOST} ^woods-furniture\.co\.uk[nc] rewriterule ^(.*)$ http://www.woods-furniture.co.uk/$1 [L,R=301] It appears that not escaping the '.' in the match string can cause problems with some hosts.2) You need to find out if the apache mod_rewrite module is installed for your hosting package. If not then you can't do this, or you need to urge your host to implement it, or you need to change hosting company Paul Link to comment Share on other sites More sharing options...
Digital Cipher Posted November 10, 2008 Author Share Posted November 10, 2008 Hi again I have tried Options +FollowSymlinks RewriteEngine on rewritecond %{HTTP_HOST} ^woods-furniture\.co\.uk[nc] rewriterule ^(.*)$ http://www.woods-furniture.co.uk/$1 [L,R=301] but still fails to work, after running a phpinfo mod_rewrite is loaded on the host serverIs there any thing else i can try? Link to comment Share on other sites More sharing options...
Paul C Posted November 10, 2008 Share Posted November 10, 2008 One last shot, then I'm beat This assumes that your store is in the root of your site. #Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^woods-furniture\.co\.uk[NC] RewriteRule ^(.*)$ http://www.woods-furniture.co.uk/$1 [L,R=301] Paul Link to comment Share on other sites More sharing options...
Digital Cipher Posted November 10, 2008 Author Share Posted November 10, 2008 Hi PaulCheers for the fast responce, changed the .htaccess file as above, still no luck, im i right the .htaccess file permissions is 0755 or is it 0644anyway cheers for trying, can anyone else shed light on this problem. Link to comment Share on other sites More sharing options...
Digital Cipher Posted November 10, 2008 Author Share Posted November 10, 2008 sorted it !!!!Big thanks to paulc & jhnstcks for pointing me in the right direction, after a bit of google i found this works Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yoursite.com [NC] RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] Link to comment Share on other sites More sharing options...
Recommended Posts