Using a htaccess file to modify access to your website

Sometimes it is necessary to restrict access to your website wether its for development purposes or to block certain IP addresses e.g bots / hackers. To do this you need to create a htaccess file and place it in the folder you wish to protect. For example if you wish to restrict access to the entire website, you would place the htaccess file in your root web folder , in our example below this would be the httpdocs folder.



  • Login to your client area http://ca.myhost.ie and click on Services > My Services and click the drop down menu opposite the service you want to access and click Open Control Panel
  • If you have a multiple webspace subscription click the Webspaces tab and select the webspace you want to modify . If the webspace tab does not exist then go ahead and click on the FILES option from the Menu.
  • You will see a top down layout of your web folders. Select the HTTPDOCS folder or if you have more than one domain , choose the appropriate site folder where the website files are stored.
  • If the htaccess file does not already exist, from the new menu that appears click New > File and enter the file name .htaccess and click OK . Its important to put the . before the filename to make it executable.
  • Now you should have a file called .htaccess in the root folder of your website.
  • Next we have to edit this file, hover your mouse pointer over this file and a drop down menu arrow appears , click it and choose Edit In Text Editor.
  • The contents of the .htaccess file will open.If the .htaccess file previously existed look for an entry called order allow,deny and a list of deny from <ip_address> entries below it. This is where you will add the IP address you wish to prevent from accessing your website e.g deny from XXX.XXX.XXX.XXX so anyone trying to visit your website from this IP address will be restricted. See example below

To block visitors to your site from specified ip addresses use the following syntax:


# Access rules 
order allow,deny
deny from XXX.XXX.XXX.XXX
allow from all



To block all visitors to your site but for the specified ip's use the following syntax:


# Access rules 
order deny,allow
allow from XXX.XXX.XXX.XXX
deny from all



Above is just an example but once you are happy the entries are added you can click the OK button to apply the changes.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How Do I Upload Files Via FTP

First you need to get an FTP client. There are lots of free clients on the web. Once you've...

I have a website, where/how do I upload my website files?

If you have created a website and wish to upload it to your webspace, you must upload it into...

How to redirect your site using htaccess

It is sometimes necessary to redirect an entire domain to another destination domain . This can...

Installing Wordpress or an application from the Application Vault returns an error.

You might find when installing an application from the Application Vault for example Wordpress,...

Migrate Wordpress to a new domain name

Changing Your WordPress Domain Name While Moving Your Site to a New Location There are different...