.htaccess basics
Previously I have written articles on .htaccess, they are:
- Tip: Increase your blog’s chances to get Stumbled(Upon)
- How to redirect traffic that comes from certain URL to another
- Why you should redirect yourblog,com to www,yourblog.com
But since not all of you know how to use and modify .htaccess file on your server, I am writing this basic htaccess tutorial.
What is this (htaccess) file and what does it do?
It is a file for managing directories on the web server (i.e your web hosting). the name htaccess comes from “hypertext access”. With htaccess, you can do many things, like:
- Defining your error documents (eg. 404 errors)
- Password protecting your directories
- Blocking users by IP
- Blocking traffic from certain sites
- Blocking bad bots (eg. spammers)
- Preventing hotlinking of your images
- Redirecting pages to another
- and many more
Where is this file?
.htaccess is a file that is usually found in your root directory. If your web-host allows you to see it, you can see the file together with your other files in your root folder (see below). However sometimes web-hosts do make them hidden (so that you don’t accidentally modify it or delete it).

You can also create different .htaccess files for different sub-folders on your website. It doesn’t necessarily have to be in the root folder. However htaccess directives in the root folder will apply automatically to all sub-folders, so you have to be careful of what you do with it. For example, blocking google.com will be a nightmare to most sites. Especially if you are an e-commerce site that rely on Google traffic.
How to create them?
htaccess files can be created by notepad. Here is a sample htaccess file from my adesdesign.net site.
You can see that in my htaccess file I have defined Error files, and also have redirected adesdesign.net to www. adesdesign,net (with www). As you know URL with and without “www” are considered two different websites to the search engines. Therefore redirecting one to another is very important. Here is how you can do that.
So, creating htaccess file is easy. Just open the notepad, type in your commands and save it as .htacess (yes with dot in front) for the file name and select “all files” for file type as shown in the screenshot to the right. Save.
I hope you find this article useful. Do let me know if you have any questions in the comments section.
Subscribe to RSS: click here.
Related Posts- Why you should redirect yourblog.com to www.yourblog.com
- wordpress theme tutorial
- Tip: Increase your blog’s chances to get Stumbled(Upon)
- How to redirect traffic that comes from certain URL to another
- Lynda.com’s blogging tutorial










By balootisme on May 15, 2008
this is what i need to change permalink from default url to seo friendly url
thanks ades…
but, i can’t found file .htaccess on my blog folder files…and on my public_html file too…
how?
By Ades on May 15, 2008
balootisme, which means your htaccess file is hidden. you can create a new one and upload it to your server. after you upload you might not be able to see it, since it’s hidden at the moment.
[as usual, be careful when working with your htaccess file]
By Rajaie on May 16, 2008
Hey Ades, great article, but when I try to access “Why you should redirect yourblog,com to www,yourblog.com” the article is all messed up with weird characters.
Any idea how to fix it?
By Ades on May 16, 2008
Rajaie, it’s now fixed.
By Rajaie on May 16, 2008
Sorry, but it’s still the same
By Ades on May 16, 2008
Try deleting your browser cache Rajaie
By Rajaie on May 16, 2008
It works, thanks :-)
By Marketing Man on May 17, 2008
Great post as usual. I did not know that we could block users, with this, from particular IP addresses, will chat to our developer. Thanks
By Yan on May 18, 2008
Hi Ades,
I’d like to know that if I set the WordPress address (URL) and Blog address (URL) on my Admin > Setting as thoushallblog.com, do I still need to edit my .htaccess?
By Ades on May 18, 2008
yes yan you still need to, because you don’t know how people type your url. some type it with www and some without. so by editing your htaccess you standardize your urls
By Yan on May 18, 2008
Thanks for your prompt reply. But in which situation people will type the url with www when each time I only show without www?
By Ades on May 18, 2008
well, you can’t control people’s behavior right? if they feel like typing www in front of your url, what can you do? that’s where htaccess comes… besides if you do not combine them, you will lose out on the SEO thing
By Yan on May 18, 2008
Yes, you have your point. Thanks for the helpful tips.
By computerevo.com on May 20, 2008
It works! Thanks man .good!
By Secret Affiliate Code on Jun 7, 2008
I’ve also used .htacess on my sites to redirect all pages to just the http://www. format so that a regular http://… address and http://www…. address don’t get listed twice by the search engines.
If this happens for every page on your blog, you can end up with stuff getting de-indexed for dupe content
By Blog for Beginners on Jun 8, 2008
I’m beginning to wonder if this is the reason I lose my ranking out of a sudden. I was on the top 10 for ‘blog for beginners’ and now I was not even in the next 100 for that keyword.
What amazes me more is the fact that I wasn’t even in the first page for keyword ‘thoushallblog’ if you know what I mean..
Sad but it’s true.