Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-03-2012, 12:29 PM   PM User | #1
Viltnieks
New to the CF scene

 
Join Date: Aug 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Viltnieks is an unknown quantity at this point
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.
Viltnieks is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:26 AM.


Advertisement
Log in to turn off these ads.