PDA

View Full Version : Duplicate page problem


OSCC
02-28-2005, 12:14 AM
Google has apparently decided that since I my pages show up as both http://www.mysite.com
http://mysite.com that I have duplicate pages and has killed my site. I used to be in the top five but now I am not in the top 300.
Where can I get help on using my htaccess file to force all requests for http://mysite.com to put http://www.mysite.com in the url box?
I cannot use mod rewrite, the site crashs.
Here is my htaccess
ErrorDocument 404 /page_not_found.htm
ErrorDocument 403 /page_image_ forbidden.htm
SetEnvIfNoCase Referer "^http://www.mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://www.mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^$" locally_linked=1
<FilesMatch "\.(gif|png|jpe?g)$">
Order Allow,Deny
Allow from env=locally_linked
</FilesMatch>

Thanks OSCC

phpmaven
02-28-2005, 12:41 AM
OSCC,

Well, you need to pick one or the other and go with it. Assuming that you are going with www you could put the following into your .htaccess file:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

This would force a 301 redirect to www.mydomain.com on any request that had a host other than www.mydomain.com

I know that you said that mod_rewrite is crashing your site, but I'm assuming that you had an error in your rules.