This article applies to Linux Hosting accounts.
How do I create an .htaccess file?
This process is very simple.
1 Open Notepad or a similar text editor.
2 Type in the directives that you want included.
3 Save the file with the file name ".htaccess".
4 Ensure that the file type is set to "All Files".
5 Click the "Save" button.
Once you have created the file you will need to upload it to your webspace.
How do I create my own error pages?
1 Open Notepad or a similar text editor.
2 Copy and paste the following text into your new .htaccess file:
ErrorDocument 400 http://www.mydomain.co.uk/400.html
ErrorDocument 403 http://www.mydomain.co.uk/403.html
ErrorDocument 404 http://www.mydomain.co.uk/404.html
ErrorDocument 500 http://www.mydomain.co.uk/500.html
3 Replace "mydomain.co.uk" with your own domain name, then save the file with the file name ".htaccess".
4 Make sure that the file type is set to "All Files".
5 Click the "Save" button.
Tip:You will need to upload the error pages, e.g. 404.html
How do I show a file list rather than a webpage?
The following process will show a list of files rather than displaying the webpages automatically.
1 Open Notepad or a similar text editor.
2 Copy and paste the following text into your new .htaccess file:
Options -Indexes
Please Note: The space after "Options" is required.
3 Save the file with the file name ".htaccess".
4 Make sure that the file type is set to "All Files".
5 Click the "Save" button.
This can be useful if you are offering files for download, e.g. software updates
How do I deny access to certain IP Addresses?
This process is useful if you have information on your website that you only want certain people to see.
1 Open Notepad or a similar text editor.
2 Copy and paste the following text into your new .htaccess file.
<Limit GET HEAD POST>
order allow,deny
deny from 215.49.8.17
deny from 159.64.9.
allow from all
</LIMIT>
In your htaccess file, amend the above code, changing the IP addresses to suit your needs. Each command should be on a separate line
3 Save the file with the file name ".htaccess".
4 Ensure that the file type is set to "All Files".
5 Click the "Save" button.
Tip: You can deny access based upon an IP address or an IP block. The above process blocks access to the site from 215.49.8.17, and from any subdomain under the IP block 159.64.9. (159.64.9.1, 159.64.9.2, etc.). This can be very useful if there is another site linking directly to your images or content.
You can set an option for "Deny From All", which would deny everyone access. You can also allow or deny access by domain name rather than IP address ("Allow From .my-wf-domain.co.uk" works for www.my-wf-domain.co.uk or support.my-wf-domain.co.uk, etc).