Facebook LinkedIn
  • Home
  • Pay Invoice
  • Service Plans
  • Contact Us
  • Learn More
    • Candyweb.US and You
    • SEO and Marketing
  • FAQ
  • Tech Blog
  • Portfolio

Force Traffic to mysite.com

Details
Last Updated: Tuesday, 28 October 2014 15:21
Hits: 2340

Warning: This article is for web developers. If you are not a web developer, you may suffer from extreme boredom. Proceed with caution.

Some web users always type in www.sitename.com and some just go straight for the sitename.com. I am in this second group. I don't like to waste time. The first group is shrinking, but still exists, so it's important to know how these requests effect your page ranking.

What some people don't know is that search engines see the two different addresses as separate websites, because http://www.sitename.com is technically a subdomain of http://sitename.com. So indexing occurs twice, and different page rankings are calculated for the traffic driven to each 'separate site'.

This can hurt your page rank by splitting your significance factor potentially in half.

So a really good idea is to use a redirect technique to force all the traffic to one or the other.

Some people recommend sending all the traffic to www.sitename.com because it looks more commercial and is sometimes recognized a slightly more significant by search engines.

But I just like the straight http://sitename.com better. I feel that quicker and easier is better, especially when we're talking about easier to remember my name and get to my site!

So I chose to use the mod_rewrite rule by means of my .htaccess file in my server's root directory.

For most sites, one simply needs to create a file named .htaccess and put the in following:

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

This forces all traffic to the non-www version: http://sitename.com. To do the opposite, and force traffic to go to http://www.sitename.com, do the following instead:

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

Since I use Joomla for my website, I used a slightly different procedure. There is already a .htaccess file in effect, that uses some other mod_rewrite rules for security purposes. So I pulled it up and edited it in the following way.

AFTER THIS LINE

########## End - Rewrite rules to block out some common exploits

I ADDED THESE LINES

###### Rewrite Rule To Force traffic from www.candyweb.us to http://candyweb.us ###
#
RewriteCond %{HTTP_HOST} ^www.candyweb.us
RewriteRule ^(.*)$ http://candyweb.us/$1 [R=permanent,L]
#
##### End Rewrite Rule for forcing non-www

And now, try going to www.candyweb.us or http://www.candyweb.us and see what happens!

fruit_piled.jpg

Contact Candyweb.us
Huntsville, Arkansas
Call us: 479-981-2784
blue_wrapped.jpg
Site Design by Candyweb.us   Copyright © 2009-2020.   All Rights Reserved.