Redirecting to WWW with .HTACCESS
| by trigatch4 on September 21st, 2007 |
The Google PageRank update is well overdue and that means the broken english bunch at Digital Point are clamoring about what in the heck could possibly be going on. Is there an update coming? Are they doing away with PageRank? I don’t know and I don’t REALLY care although it’s fun to give yourself a self-serving pat on the back (albeit pointless) when you gain some PR. Not to mention it helps when selling links and sites.
That being said, I know one thing that has HURT PageRank in the past is when your site allows users to visit pages in two different ways:
- http://www.yoursite.com
- http://yoursite.com
Why you ask? Because Google supposedly views these as two completely different pages. Why is this important? Because first of all, backlinks are an important ingredient to the search engine rankings of every website. Links could be pointing to your sites and pages using both the www and non-www variations of your web address. Why would you want to have 2 pages with the exact same content that have 50 links to each? Not to mention, does this bring up a duplicate content penalty issue? Why not redirect one page to the other and have 1 page with 100 backlinks? That’s exactly what we’re going to do.
Imagine how important this could be. What if you have pages ranking on the 2nd page of the SERPS in position 11 or 12 without redirecting. Then, after making the changes, your site is viewed as having those extra critical links that move you above several competitors onto the front page. That’s a silly simple way to increase traffic. And not only that… but PageRank as well. And probably a bunch of other benefits to boot.
The bottom line is… it’s such a simple fix… there’s no reason NOT to do it. Tonight, I implemented this redirect across every site I own. Here’s what you do:
- In each domain folder, create a file called .htaccess (that’s right… a period before and nothing afterwards.)
- Open the file in a text editor and copy/paste the following code between the hashes:
—————————————
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
</IfModule>
—————————————
ALRIGHT BACK TO THE NARRATIVE:
Now if you already have an .htaccess file and it already has stuff in it, simply place the lines starting with RewriteCond and RewriteRule as the first line below “Rewrite Engine On” and you should be good to go.
This worked for me in not only Wordpress while still using permalinks but also with vBulletin and regular old HTML sites.
It will be interesting to try and track/note any beneficial results from creating this redirect and time shall tell. In actuality, time probably won’t tell. There are too many factors that cause fluctuating traffic and I’m hoping to get traffic to increase every day regardless of this little “trick”. So… it will be pretty much impossible to note how much positive push I get from this alteration alone. One thing is for sure - it won’t hurt.
I guess this inability to seclude this factor and weight it’s value is what has me curious about making this change and then witnessing changes in PR in the next update (if there is one). Ugh… a product of my own complaints.
I also might note that there are a couple wordpress plugins that complete these exact functions. Here is one that I found and here is another. In addition, because this is my first time attempting this, you may run into some problems/issues/variances. Heck… I might to. But in the long run it’s all for the better!
*20 minutes pass*
*runs back to keyboard*
I’ve just been informed that this .htaccess change has messed up the commenting feature on this very blog. Son of a gun and I thought it could be so easy! It’s a wordpress problem because my vBulletin sites are doing fine.
I just downloaded and installed the WP redirect plugin from fucoder (see above) and the redirects didn’t even work. I then tried the second plugin called yes-www and while the redirects worked… comments still don’t work. Is it just a problem with this theme? Maybe.
Regardless, I was able to add the redirection to a dozen other sites that don’t have any negative or unintended sign effects. And the Bible says so… So yeah… I’m right for sure.
Sorry it’s late and I’m tired. That last quote was a tribute to my absolute favorite person on all of YouTube - DaxFlame! This is the clip (one of my favorites) from where this quote originates.





1. trigatch4 wrote on September 21, 2007
If this comment works everything is back to normal… including my non redirected URLS… dangit and hooray at the same time.
Feel free to chime in with what you think is the best solution.