14 Oct 2010 @ 1:34 PM 

Here is few examples how to create a redirect from using .htaccess file:

This redirect allows to redirect all requests from www.yoursite.com to yoursite.com (why it should be done? Google skip mirrored sites, for example www.yoursite.com and yoursite.com are different sites for Google, so some pages can be indexed only for www.yoursite.com and some only for yoursite.com, as a result your domain loses Google Page Rank, so you should decide which of them will be used).

Redirect from WWW to NON-WWW

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

Redirect from NON-WWW to WWW

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

Redirect from NON-WWW and WWW to another path

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yoursite.com$
RewriteRule ^(.*)$ http://someurl.com/ [R=301]

Posted By: lvlind
Last Edit: 06 Oct 2016 @ 04:15 PM

EmailPermalink
Tags
Tags: ,
Categories: How to?


 

Responses to this post » (None)

 
Post a Comment

You must be logged in to post a comment.

Tags
Comment Meta:
RSS Feed for comments

 Last 50 Posts
Change Theme...
  • Users » 1
  • Posts/Pages » 35
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Need Help?



    No Child Pages.

Check your IP



    No Child Pages.