Forum Moderators: mack
There instructions for redirecting pages are to create files called:
error400.html
error403.html
error404.html
error500.html
and upload them.
I have recently been reading the Google section of this forum and I am very unclear about what the best way is to redirect pages. Apparently Google can penalize a site for doing it wrong.
For instance if someone types
[webmasterworld.com...]
Secondly without the www's (webmasterworld.com)
Both of those pages should end up landing on the same page. They don't on my site.
I hope this made sense. Can anyone shed some light?
C
The redirection that is being offered by your host is simply for error handling. For example if a user tried to go to example.com/foo but the page doesn't exist the server will handle it as a 404 (page not found) all the server will do is send the user to your custom 404 page. On this page you can have links to your important areas, to try and convert the user who has not found the information he#she was looking for.
You can do the same for all other error types. This form of redirection will only handle lost users (users who encounter an error) and will not effect your site in any other way.
Mack.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}!^www\.yourdomainname\.com [NC]
RewriteRule ^(.*) [yourdomainname.com...] [L,R=301]
If you don't have an .htaccess file in your root directory, then open notepad and type that in there and save it as htaccess.txt or htaccess.htaccess and FTP into your root directory and upload the file. Once the file is there rename it .htaccess. Now when someone types in yourdomainname.com into their browser, they will be redirected to www.yourdomainname.com. This includes spiders as well. What happens is. without this rewrite on. Your page rank is split in half. That's the penalty the search engine dishes out to you.
HTH
I didn't have a htaccess file so I copied the text as you sent it - changed it to my domain in two places.
Saved as a txt
uploaded
Changed to .htaccess
... Then the file immediately disappeared?
... Does that mean 1and1 doesn't allow .htaccess?
I checked online to see if it changed but no luck?
Try putting the .htaccess file in your www directory. That would be the "public html" folder. See if it disappears from there. The reason I told you to put it in your root directory is because that way it will affect your whole site. It will work in the public html directory just fine as well.
HTH
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ [yoursite.com...]
If this or the other redirect doesn't do the job for you after you test it. You should remove it asap.
I'd recommend either:
Options +FollowSymLinks
RewriteEngine on
# If requested hostname is non-blank
RewriteCond %{HTTP_HOST} .
# and if requested hostname is not the preferred one
RewriteCond %{HTTP_HOST} !^www\.yourdomainname\.com
# Then redirect to preferred domain
RewriteRule (.*) http://www.yourdomainname.com/$1 [R=301,L]
Options +FollowSymLinks
RewriteEngine on
# If the requested hostname is the non-preferred one
RewriteCond %{HTTP_HOST} ^yourdomainname\.com [NC]
# then redirect to the preferred domain
RewriteRule (.*) http://www.yourdomainname.com/$1 [R=301,L]
Jim