Forum Moderators: phranque

Message Too Old, No Replies

301 redirect, how do I do it

Need some help, I can't figure this out

         

Cheef

1:56 am on May 3, 2006 (gmt 0)

10+ Year Member


I am trying to 301 redirect http://mysite.com to http://www.mysite.com (I don't want to get the SE duplicate content penalty). I couldnt find the .htaccess file, so I created my own and used what I found on the internet about the 301 redirect. Anyways, it didnt work so I was wondering how to do it. My hosting is provided by ipower.com and the servers run on FreeBSD 4.11-STABLE. If any of you guys have any experience with this or can help me that would be great. Also, maybe you know where the .htaccess file is, or where I am supposed to put it.
Thanks

jonrichd

11:40 pm on May 3, 2006 (gmt 0)

10+ Year Member



Cheef,

The .htaccess file is normally located in the root www directory on your server (the same directory that you would find your home page). There is no requirement that there would be an .htaccess file, so it's likely that there wasn't one when you got your domain.

Here is an example of an .htaccess file that redirects traffic from the non www version to the www version of your site:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Make sure that when you upload your .htaccess file to your server that you do it in ASCII mode rather than binary mode, or it won't work. Also, the file must be named .htaccess, which can be difficult to create in the typical Windows desktop, which wants a filename before the period. One solution is to create htaccess.txt in Windows, FTP the file to your server, and rename it on the server once you get there.

There's a ton more information on .htaccess files in the Apache forum [webmasterworld.com]. You might want to browse through there is you continue to have problems.

Cheef

2:52 am on May 4, 2006 (gmt 0)

10+ Year Member



Thanks for all the info, I will try it out. The only other thing is if I use the example you gave me will it avoid the search engine penalty for double content. Thanks for the help

edit: I just tried it out and it works, thanks for the help! I am still curious if I will get the search engine penalty though? Thanks again.