CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   Problems with www prefix (http://www.codingforums.com/showthread.php?t=275038)

Viltnieks 10-03-2012 12:29 PM

Problems with www prefix
 
Hello!

Recently I found out that I should deicide either I stick with using my domain with www or without it, to avoid duplicate content.

I deicided I would like to go with www prefix

Problem is that most links in google search results don't have www. prefix.

So I went to google webmaster tools and set prefered to www. (both for domain.com and domain.com)

Next I added this to .htacces
Code:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

this works fine when I enter domain.com it automatically gets redirected to www.domain.com

but If I enter address like domain.com/category/item-1
I get redirected to domain.com/index.php

What could I do to fix this ?

Do I need to write redirect for each page, from non-www to www. ?


Google still hasn't added www. to search results.


All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.