How to Manage Hosts File Using the Mozilla SwitchHosts Extension

How to Manage Hosts File Using the Mozilla SwitchHosts Extension

The Mozilla SwitchHosts extension or add-on is useful if you want to switch your web host, but prefer to try the new host out before committing to it. It is a big step to change your website hosting service, and you certainly want to know that it will handle your blog before you take that step.

To do that you will have to point your computer to your new hosting service as being the current one. There is a file in your operating system known as the ‘hosts’ file, which provides your computer with the IP address of the hosting service for named domains. In order for your computer to detect the temporary service as hosting your blog, you must change the contents of the hosts file. If you use Firefox, here is how to achieve that quickly and easily using a Mozilla add-on.

Switching your WordPress Blog

Let’s take a WordPress blog as an example. Perhaps your blog has outgrown your current web hosting service and needs more server space or bandwidth. Perhaps you want a more dedicated service for your blog, such as switching from HostGator to WPEngine. Whatever the reason, it makes sense to try out the new service before moving from the old.

The easy way to do that is to set up a trial account on the new web hosting service, install and configure WordPress to mirror your existing installation, and then copy the folders and files that relate to your WP blog over to your new server. However, you still want your blog to be live rather than close it down while you set up the trial.

Switching a Website

If you want to switch a website, you can set up a directory on your new hosting server and then FTP or copy all the folders and files of your existing web root to the new server so that the entire website structure is mirrored on your new domain.

Once you have completed either of these two tasks, you are ready to test your new host. To do that, your computer must recognize your site or blog as being hosted by the new service. To achieve this you must edit the hosts file in Windows or Ubuntu if you are using that OS.

This is where the Mozilla SwitchHosts extension comes into play. It can save you a great deal of work and time seeking out and editing this file. Here’s how:

How to Use SwitchHosts

First install the Switch Hosts add-on. To do this:

  1. Go to your Firefox browser and click Tools -gt; Add-ons -gt; Get Add-ons
  2. Use the top right search box to find SwitchHosts
  3. Click the ‘Install’ button
    Search SwitchHost Addon
  4. Close and restart Firefox
  5. Click on the Tools menu, then on SwitchHosts (Press Alt button to show Tools menu) – you get this:

    Use SwitchHost
  6. Now click on ‘Before you start (Click!)’ and you get this message:

    SwitchHost Addon Information
  7. Click OK, so that SwitchHosts overrides the ‘hosts’ file in Windows: C:/Windows/system32/drivers/etc/hosts
  8. You then get a message relating to backup of your hosts file. Take a note of the location in case you want to recover it, then Click OK.
    SwitchHost Warning

Now you can use the add-on to switch the web hosting service recognized by your computer. Here is how to do that.

Switching Your Web Host Using the Mozilla SwitchHosts Extension

A. Go to Tools on your Firefox menu bar and click on SwitchHosts>Hosts Management. You should now see the following screen:

Host Management SwitchHost

Click ‘Add’ and you will see a screen requesting the Host Name

Add Host Record SwitchHost

B. Add the name of the domain you want to switch, and the IP address of the new host. Click on the ‘Add Record’ button then OK, and your domain will be added to the new web hosting service.

Important: Add two forms of the domain: with and without the www. So you would add mydomain.com and www.mydomain.com – each separately and each with the new host’s IP address. Each should appear on the ‘Hosts Edit’ window on a separate line, thus:

Edit Host File Using SwitchHost

Now open Run Window (“Windows button + R” or open Run Window from Start Menu). Type ipconfig/flushdns in the black box and hit enter.

C. Now choose the new host file from menu. This enables you to switch from your original host to your new host with a single click.

Choose New Host File

You can save a lot of time by using the Mozilla SwitchHosts extension. Once you have used it for the first time, you will appreciate the time and trouble you can save.

If you’re using Google chrome then you can try MultiSwitch extension. Let us know your views about this Mozilla extension.


Join Our Email Newsletter

Like what you read here in this blog post? Get free blog updates in your Email!

About Rajesh Namase

Rajesh Namase is a professional blogger and founder of TechLila. He has a great passion in blogging and SEO. If you’d like to connect with him, use our Contact Us page.

Rajesh has written 214 awesome articles for us at TechLila.

Comments

 Comment Policy

Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. You can wrap code in [lang-name][/lang-name] tags.


Tell us what you're thinking...

If you want a picture to show with your comment, then get Gravatar!

CommentLuv badge