RSS Directory

Archive for the 'Tutorials' Category

I manage web hosting on two different servers with 12 different IP addresses. Recently, I moved one site I own from one server to another. I updated the nameserver from my Godaddy account, which is where I purchased the domain name, but it can take 24-48 hours for the nameservers to propagate before the site will come up from its new location.

The problem is that I needed to start working on the new site right away, and did not have time for the nameservers to propagate. That’s when I had to solve this issue myself.

With Windows, you can specify the mappings of IP addresses to host names. This way, your browser will pull the domain from the IP address you specified, so you can start using a site even before all the nameservers propagate. Here’s how it works:

Browse to C:/Windows/System 32/Drivers/Etc/hosts. You can open the file “hosts” with a text editor such as Notepad.

For example, let’s say was hosted on a server whose IP address was 12.345.678.901, and I decided to change my web host. Now, the new IP address is and I want to start working on my site right away, but when I type into my browser’s address bar, it keeps taking me to my old host at 12.345.678.901 because the new nameserver has not propagated yet.

You can open the file mentioned above and type:

Save and close the file. What you just did was tell your computer that if you type or, you want it to point you to the IP address

You can immediately open your browser, type in your domain name, and you will be taken to the location on your new host! Now you can start working on your site at its new location immediately, without having to wait on the nameservers to propagate.

I know that this little trick has helped me a few times in the past. Maybe it’s something that you can keep handy which can help you one day as well.

10 people had something to say. What do you think?

You’ve heard it over and over again- backup, backup, backup! The importance of backing up your site goes unseen until a problem arises. Instead of barking the need to backup your site to you (because you already know that, right?) I’m going to show you how to backup your SQL database. For the purposes of this tutorial, I’m going to backup my WordPress database.

As I’m sure you know, all of the content within your blog resides in the database- not the files. If you don’t backup your database, you risk losing every  post, page and comment in your entire blog. Your admin interface may differ depending on your webhost, but here’s some screenshots using cPanel:

First, login to your site’s cPanel and click on the “MySQL Databases” icon. Scroll to the bottom of that page and click on the “phpMyAdmin” link.

On the left side of the screen, you will notice a drop down menu. Use that menu to select the database you wish to backup.

Once you select your database, you will notice some tabs towards the top of the screen. Click on “Export”.

Next, on the left side of the screen you can select which tables to export. Click the “Select All” link. Be sure all the tables are selected.

Towards the bottom of that screen, click the “Save as file” box, and name the file something you can easily remember.

Click the “Save” button to save the file to your computer. Congratulations! You have just saved a copy of your database. Keep it in a safe location. If you ever need to restore a backup at a later date, click on the “Import” tab on the same screen you just clicked “Export” and select the database backup file you wish to restore to.

This should be a part of your regular routine. How frequently you decide to backup your database depends on you. The busier your blog is, the more frequent you should backup your database. Don’t wait until it’s too late to set 5 minutes aside for regular website backups!

I know this short tutorial may seem elementary for many of you, but now if you’re blog crashes I can say “I told you so”!

8 people had something to say. What do you think?

This is the last in a three part htaccess tutorial. Feel free to review part 1 and part 2 before continuing.

In this tutorial, I will show you two final ways you can use htaccess on your website to make life a little easier for you.

Remove WWW

Why would you want to remove “www” from your domain name? Well, in terms of SEO, many search engines including Google will see “” as a different website than “”. Each would have its own PR ranking, and that’s not good.

You can test it out here on this website. Look in your address bar. There shouldn’t be any “www” in my domain name. Go ahead and try to type it in and see what happens. My htaccess file forces the removal of “www” so that all the statistics for don’t get split between “” and “”. Here’s how to do it:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Obviously, you would want to change “” to whatever your domain name is.

Change Default Home Page

Have you ever wanted to display a special notice to all of your website visitors, such as an upcoming change to the website or any other important announcement? Well, what’s the first page a visitor sees when they type in your domain name in their browser? Your “index” page? Well, you can make it so that the first page a visitor sees is something like “announcement.html”, which would contain your important announcement. Keep in mind, your visitors will only see this page if they try to view the default index page of the directory. They can still type in another address or a specific page and bypass this altogether. Here’s the code:

DirectoryIndex announcement.html

Again, adding that line of code to your htaccess file will bypass your “index” page in a directory and display “announcement.html” instead. As always, you can change that page name to whatever you would like.


This would conclude the three part series on .HTACCESS- Your New Best Friend. I hope that you gathered some information from these articles that you find helpful and will possibly implement on your own website.

1 person had something to say. What do you think?

Now that you’ve got your htaccess file created, you’re ready to start using it. Believe it or not, your htaccess file is used for more than just error pages, and I’m going to show you some of what you can do.

If you didn’t catch part 1, which is an introduction to htaccess, read that post first.

Block Users by IP

If you notice that somebody is coming to your site and trying to do something you don’t like, just ban them! This is especially useful if you have a website where users can contribute to the content of the site, such as with a forum or blog, and somebody is spamming you.

So, open up your .htaccess file and type the following:

order allow,deny
deny from 595.33.8.7
deny from 012.34.5.
allow from all

Of course, you would replace the IP’s with the ones you wish to block. You can either type in the entire IP address to block that particular IP, or you can block groups of IP addresses.

For instance, in the above example, deny from 012.34.5 will block all IP’s under that one, such as:, etc.

Deny Referrer

You can also deny a visitor if they are coming from a particular referrer. A new tactic used by people to hurt your search engine rankings is to send a lot of bad traffic your way. For example, if you rank #1 in Google for the search term “cool blog” and I’m #2, I might spend $50 to send 500,000 fake garbage bot visitors to your site hoping that Google will recognize your traffic is not all genuine and bump your position down a little, giving me the #1 spot. In such a case, you would see thousands and thousands of hits coming from the same referring URL in your site stats, usually coming from a cheap traffic company.

Note: Your hosting provider must have mod_rewrite enabled on your server in order for this code to work.
Here’s the code:

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} trash\.com [NC]
RewriteRule .* – [F]

Replace “trash” with the domain and “.com” with any other extension the site may be (.net, .info, etc.)

To block more than one referring URL, you would use:

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} trash\.com [NC,OR]
RewriteCond %{HTTP_REFERER} moretrash\.com
RewriteRule .* – [F]

The only difference here is that you would add “[NC,OR]” after each domain listed except for the last one in the list.

If you get a 500 Internal Server Error when using this code, just delete the “#” in the second line of code.

Prevent Hotlinking

Somebody stealing your bandwidth? If you have a picture or video on your website that people like, sometimes they may post it on their websites, but it will be pulling everything off of your website using your bandwidth.
Again, you will need mod_rewrite to be enabled by your web host.
Here’s how to do this:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ – [F]

Of course, you would replace “” in the code above with your actual domain name. You would also enter all the domain extensions you would like to disallow hotlinking to in the last line. The code above is set to disallow hotlinking any gif, jpg, js or css files from your site.

To really have fun, you can show whatever content you want when somebody tries to hotlink from your site. For example, if somebody tries to hotlink a pretty image of a sunset on the beach from your site, an image saying “I STEAL BANDWIDTH!” can be shown.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?*$ [NC]
RewriteRule \.(gif|jpg)$ [R,L]

In the code above, if somebody tries to hotlink a gif or jpg image from your site, it will display a picture called yousteal.jpg on their site!

I’ve got some more tricks up my sleeve for you regarding htaccess, but I’ll have to include them in my next post on this series, part 3.

If I make these posts too long, I’ll get a ton of angry emails… :)

Check back soon for .HTACCESS- Your New Best Friend (Part 3)

7 people had something to say. What do you think?

Anyone who has tampered around with web design has probably heard of htaccess, even if they are not totally familiar with what it is, or what it can do. The fact is, every single website owner should know what htaccess is, be familiar with its functionality, and USE IT!

This article will give you a brief introduction to what htaccess is, and teach you how by using it, you can make your website more secure, improve your search engine rankings, and give your website a more professional image.

.htaccess- What Is It?

Wikipedia’s definition for .htaccess is as follows:

“.htaccess (Hypertext Access) is the default name of Apache’s directory-level configuration file. It provides the ability to customize configuration directives defined in the main configuration file. The configuration directives need to be in .htaccess context and the user needs appropriate permissions.”

.htaccess is a simple ASCII file, which you can create using a text editor such as Notepad. Many people get confused as to how the file should be named. The important thing to know is that .htaccess is the file extension, not the name. You notice that nothing appears before the period (.)- not file.htaccess, pagename.htaccess, but just .htaccess.

Because htaccess is handled by Apache and not NT, they will only work on web servers running Apache. If your web hosting is done on a Linux server, you’ll be fine.

Creating an .htaccess File

Before I go in to this, I must mention that some web hosts (mostly free web hosting providers) may not allow you to use htaccess files. Be sure you are able to use htaccess files so that you don’t get into trouble with your web host and get your account suspended. If you already have an htaccess file on your site, you should be fine. Also, I am writing this article as a tutorial and don’t accept any responsibility for anything that happens if you goof something up, or if you run into any problems! Your htaccess file can do a lot of good, but it can do a lot of damage as well, and I don’t want to be responsible for that!

First, you can login to your website using your FTP program. I will not go into the specifics of FTP, as this is beyond the scope of this article. We’ll assume you know this much already. Browse to the root folder of your website, many times named “public_html”. If you don’t see a file named “.htaccess” already, all you have to do is open up a text editor such as Notepad (In Windows, click Start > Run > type “notepad” > OK). Save the blank file as .htaccess, making sure not to leave a .txt or any other extension at the end of the name. Upload the file to your public_html folder in ASCII mode (NOT binary). If you don’t know what I’m talking about don’t worry- most FTP programs will automatically select the correct upload mode. Be sure that the permissions, or attributes for this file are set to 644 (RW-R–R–), to prevent other people from having access to this file.

Congratulations! You’ve just created your .htaccess file!

NOTE: If using FrontPage extensions for your website, you can not edit the .htaccess file without ruining your FrontPage extensions. ONLY modify your .htaccess file if you ARE NOT using FrontPage extensions on your website.

Working With htaccess

Now that you’ve got the file on your site, you’re ready to begin. If you already had an .htaccess file, you can add what you’d like on to it.

This is the end of part 1 of our .htaccess tutorial. Part 2 will walk you through some of the functionality of your .htaccess file.

3 people had something to say. What do you think?

© 2022 c/o Neon.