Larry’s Computer Classes

center ad

Learn Computers with Video's

Beginner Video's Classes

Basic computer skills and settings

Intermediate Video's Classes

Microsoft Word, PowerPoint and Excel

Advanced Video's Classes

Create and design your own website

Click For Video's

HTACCESS FILES for web hosting

Previous tutorials are listed in the left column.

.HTACCESS FILES for web hosting (improve your page ranking with Google)

This article is for anyone who has a web page uploaded to a host server. If you are using a web server host and you want Google to index your pages you must use a .htaccess files in your root file. (Root file is the place were you upload all your web page files too).

The first thing that you need to do is place a redirect code in this .htaccess file. A redirect code will do exactly what it says; it will redirect a webpage to another web page. Example: when Google goes to your site and analysis’s it two web pages show up. One webpage contains the www. and the other does not contain the www. So to googlebots your web pages show up as two different web pages and to googlebots this is considered duplicate contents. Don’t ask me why googlebox’s do this I don’t know. But to correct this problem use your text editor such as notepad or any text editor you are accustom to using; copy and paste this code in the text editor.
RewriteEngine on rewritecond %{http_host} ^larryscomputerclasses.com [nc] rewriterule ^(.*)$ http://www.larryscomputerclasses.com/$1 [r=301,nc]
Don’t forget to change my web address to your own. This code redirects larryscomputerclasses.com (without the www.) to www.larryscomputerclasses.com with the www attached.

If you want to redirect the www.larryscomputerclasses.com to larryscomputerclasses.com without the www then just reverse the web addresses. Like so
RewriteEngine on rewritecond %{http_host} ^www.larryscomputerclasses.com [nc] rewriterule ^(.*)$ http://larryscomputerclasses.com/$1 [r=301,nc]
Then save your file in the text editor and name it .htaccess.txt (don’t forget to place the dot in front of the htaccess. Once you have the file saved upload it to your host in the same directory as all your other web page files.

This code is for web host using apache servers, if your web host is using Microsoft server 2003 or any other server you will have to go to Google Search and type in .htaccess redirect code for Microsoft servers. I don’t have a web page on a Microsoft host server so I can’t test the code. But Google Search will give you plenty of help. If you can’t find what you need click the contact us button at the top of this page and send me an email and I will assist you.

Once you have uploaded this file to your host when googlebot comes back to crawl your site it will only see one web page. This is good to help you increase your page ranking with Google.

Also remember after you add your redirect to your web page if you use Google Analytics or other analytics services you will only need to have one web page on your account. This is the page you redirected to. In my codes above the first code you would only need the www.larryscomputerclasses.com listed on Google Analytics. And on the second code you would only need the larryscomputerclasses.com listed.

If you have the www.larryscomputerclasses.com and larryscomputerclasses.com listed in Google Analytics then after you enter your redirect code Google Analytics will only show data for the page you redirected too the other page will stop showing data. Good Luck


For other articles also see previous tutorials.