Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
602 views
in Q2A Core by
Hi,

is this a duplicate content problem? What I have to write in htaccess to prevent google from indexing http://domain.com and http://domain.com

I want only http://domain.com

At the moment, the htaccess looks as follows:

 

DirectoryIndex index.php
RewriteEngine On
#RewriteBase /your-sub-directory
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

1 Answer

+1 vote
by

 

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
by
thanks Frank. So this is to prevent google from indexing the www.domain.com? Doesnt clash with other rules? Cheers
by
It does a 301 redirect from the www version to non-www. It should be fine on its own and not conflict with other rules.
...