Computer Geeks

Computer Geeks

Geek Shop

Geek News

Geek Stuff

Science Geek

Computer Gaming

Linux Chat

Building Websites

Computer Forums

Computer Help Forum

Computer Hardware Forum

Computer Software Programs


Go Back   Computer Forums > Building Websites

Building Websites This section covers all aspects of publishing, developing and maintaining websites. Topics include: website design, graphic design, website programming, web hosting, website marketing (SEO, link exchange, publicity, advertising), monetization & etc.

Computer Geeks
» Active Discussions
Computer Geeks
No Threads to Display.
» Other Websites
- Software Publishing

- Server Hardening
Reply
 
Thread Tools Display Modes
  #1  
Old 05-06-2006, 07:12 PM
sjaguar13 sjaguar13 is offline
Member
GB Advanced User
 
Join Date: May 2006
Posts: 50
Default Better Search Engine Optimization with Mod_Rewrite

Google sees www.YourSite.com, YourSite.com, YourSite.com/index.php, and www.YourSite.com/index.php as four different sites. The problem is that when your PageRank is split up into fourths, none of them will actually gain good results. Using mod_rewrite you can change all non-www URLs into www.

First create a .htaccess file (or edit the one you already have). You need to add the following code:
Code:
Options +FollowSymlinks All -Indexes
rewriteEngine on
rewriteBase /
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
What this does will do is tell the rewriteEngine to start looking for any incoming host that does not have the www. in front. You need to change yoursite.com to your actually domain. The it will add the www. for you. It checks to see if any other files were added, like yoursite.com/page1.php. If there was, it will add the www. in the front and also put the page1.php at the end. The R=301 says the redirection is a permanent one. This is the key for Google. It will ban you for having duplicate content, so doing a temporary redirect, a 302, isn't a good idea. Google could think that the page that's doing the redirection has the same content as the one it gets redirected to. The L says it's the last rule, don't bother looking for anymore and just redirect already.

I use this on almost all of my sites and my PR has been climbing ever since.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Powered by vBadvanced CMPS v3.2.3

All times are GMT -5. The time now is 07:30 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
HTML Help provided by HTML Help Central.