There was a problem loading the comments.

Redirect ->

Support Portal  »  Knowledgebase  »  Viewing Article


Google and most search engines see and as two different sites/pages. The problem is if you get links to your site, some with the www and some without, your total number of links isn't the true total. It's split between the two. Using .htaccess and mod_rewrite, you can do a 301 redirect to the www version.

Below is some code that will help:

rewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]

The first line turns the rewrite thing on, if it was off.

The second line is needed if you are using FrontPage with Mod_rewrite. To ensure FrontPage works with mod_rewrite, you needed to change the "Options None" to "Options +FollowSymLinks" just in each of the htaccess files of the 3 following FP directories only: _vti_bin ; _vti_bin /_vti_adm ; and _vti_bin/ _vti_aut

The third line checks for the host. The ^ means the beginning and the $ means the end.

The forth line, no checking what comes after the host, will forward any directories/files from to your domain with the www. The $1 is the variable that hold the directories/files, so would have $1 equal to some/directory/file.html. The R=301 forces a 301 permanent move redirect. Google will then see it as one domain. The L says it's the last rule. If you add other rules and leave off the L, it would go through them all before finally redirecting.

Share via
Did you find this article useful?  

Related Articles


Add Comment

Replying to  

Self-Hosted Help Desk Software by SupportPal