Jump to content

HAving to user WWW. in front of site URL address


Recommended Posts

Hi all

Has 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.6
MySQL 5
Host = Easyspace.com

Can anyone help

Link to comment
Share on other sites

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

I added the following code and still the same, it does not redirect

Options +FollowSymlinks
RewriteEngine on
rewritecond %{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

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 server

Is there any thing else i can try?

Link to comment
Share on other sites

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

×
×
  • Create New...