Tag Archive 'htaccess'

cPanel - .htaccess and IP Deny Manager Tutorial

Web hosting providers using Apache servers are equipped with a number of configuration tools designed to help clients effectively administer their website. Few of these tools have the purpose and functionality of the .htaccess file, another handy feature found with the cPanel control panel. Though small, this file is quite powerful when put into action, giving users the ability to override the default settings of their hosting provider’s server.

.htaccess is merely a simple ASCII text file, yet it can be extended to perform many different functions. Some of its capabilities include password protecting the directories of your site, to preventing intrusion from malicious hackers and redirecting visitors to different locations on the web. In this article we will cover its unique ability to block IP addresses and specific domains.

Reasons to Block with .htaccess

The web contains a great number of sites hosting interactive member forums and blogs. These sites are often targeted by several spammers and malicious hackers. Website owners have been trying to come up with a solution to this issue for years with few results. However, the .htaccess file is a tool with the power to limit this intrusive activity and give you a bit of privacy by keeping out those IP addresses and domains causing all the ruckus.

.htaccess vs. IP Deny Manager

Although .htaccess files can be easily activated from within the cPanel, choosing whether to use them or not is a difficult call. This is a sensitive file with a lot of power, meaning it could inadvertently shut down your site or negatively impact the provider’s server when used incorrectly. For this reason, the IP Deny Manager may be a better solution, another feature of the cPanel which functions similar to .htaccess.

Just like the .htaccess file, the IP Deny Manager can be used to block IP addresses and domains from accessing your website. If there is a particular IP address or domain you wish to deny access, it can be done easily from the control panel by following these directions:

log into the cPanel account

locate the “site management” tab and click on “IP Deny Manager”

find the “Add IP Deny” field and type in the address you wish to block

click the “Add” tab

This activates the IP Deny Manager and keeps the internet intruders from harassing you. The only way they can gain access to the site is if you lift the ban. This can also be done using the .htaccess file or by simply selecting the IP from a drop-down box in the IP Deny Manager utility.

Both .htaccess and the IP Deny Manager are great solutions for protecting your website against unscrupulous characters. It can prevent data from being stolen and the spamming of your interactive features. Although .htaccess works well, the IP Deny Manager is the recommended choice as it will have no negative effects on your site or the provider’s server. If would like to try the .htaccess file, be sure to inquire within your web host and find out about their regulations before carrying on.


htaccess for Password Protection - cPanel Tutorial Ch.9

Hypertext Access or htaccess was originally created as a default name of the Apache server directory configuration file.  Its purpose is to provide the power to customize directories of a server’s primary configuration file.  These directives are all required to be in .htaccess context and can only be used with the correct command lines.  The .htaccess file controls not only the directories it was created in, but all subdirectories within it as well.

As one of the most effective configuration files, htaccess is rather critical to your website.  Keep in mind that the most minimal syntax error, such as an omitted space, can result in the malfunction of your server.  It is very critical to use MySQL or PHPMyAdmin to backup your website, this includes any original .htaccess files.  Any changes that need to be made to .htaccess can easily be made within your cPanel.  We will get to that a little later.

When it comes to using the .htaccess file, options within your web hosting server seem unlimited.  With great power also comes great responsibility and risks.  By making one small mistake with the .htaccess file you run the chance of making your whole site dysfunctional.  The best way to manage your .htaccess files is certainly through the cPanel.  Your advanced administrative area will write the files out for you and is typically a safer method opposed to editing them on your own.

Many benefits come along with the .htaccess file, but protection is perhaps its most famed area.  
Password protecting your directories and website can be done several ways yet is easily managed by way of the cPanel. Here is a perfect example:

- First log into your cPanel
- You will then find the htacess/htpassword creator tool on the page.  From there you will create a username and password you would like to use for the designated directory.  
- Click on the “create file” tab
- You will then create two files, .htaccess and htpasswd

The first box on the tool page will then read something like this:

AuthName “Password Protected Directory”
AuthType Basic
AuthUserFile /your/server/path/.htpasswd
require valid-user

The AuthName field is something that may be changed as this will translate a prompt that asks for a user’s credentials.  You may wish to type in “You Must Be Logged In To Do That” or “Password Protected Area”.  You must change the AuthUserFile path and assure that the modified location is placed above the documentroot.  Refer to the example below.  

/home/username/www/secure/ - secure folder
/http://www.domain.com/secure/ - accessing domain
/home/username/www/ - where all files are served from
/htpassword: /home/username/passwords/ - the storing of our password

This is how our .htaccess file would now translate:

AuthName “Password Protected Directory”
AuthType Basic
AuthUserFile /home/username/passwords/.htpasswd
require valid-user

From the second box of the page you will copy then paste this code into the new htpasswd file.  This normally takes no longer than two to three minutes to complete after the first trial, a fairly simple process that adds great protection for your website.


htaccess Blocking - cPanel Tutorial Ch.10

Apache web hosting servers have designed a number of configuration tools to assist the user in administrating their site.  Few of them have more purpose and functions than the little file by the name of .htaccess.  This file is powerfull when changes are made within it, giving users the freedom to override default functions of their web hosting server.

As a mere ASCII text file htaccess can be evolved to perform many operations.  We previously learned that this file can password protect the directories of your website.  It also has the ability to redirect users to a different location or block IP’s or certain domains.  

WHY BLOCK WITH .HTACCESS?

There is an endless amount of sites hosting blogs and member forums on the net.  These websites are frequently targeted by an equal amount of computer hackers and spammers.  Coming up with a solution to this never ending problem has been ongoing since the internet’s introduction. .Htaccess is great tool that limits this activity and gives you a bit more privacy.

You may have observed the fact there is no prefix for this file; it simply starts with a period and is then followed by the letters htaccess.  This means that it will typically be stored as a hidden system file.  Hidden system files can easily be unveiled via the manager page of your cPanel.  Since not all web hosting servers will allow the use of .htaccess, it is certainly best to check company regulations before proceeding.

HTACCESS vs THE CPANEL

While .htaccess files can be activated in via your cPanel there has been a debate on whether you should use them or not.  Being that .htaccess is such a sensitive file that could inadvertently shutdown a website it should only be used when absolutely required.  The IP Deny Manager feature of cPanel was one designed to work similar to .htaccess.   

Just like .htaccess the IP Deny Manager allows users to block IP addresses and domains from entering your website.  If there is an IP address or domain you wish to block from your website it can simply done within the cPanel:

- First log into the cPanel account
- Find the “site management” tab and click “IP Deny Manager”
- Locate “Add IP Deny” then type in the address you have chosen to block
- Click the “Add” button

From there your IP Deny Manager has been set.  The online hecklers you have singled out will never have access to your site again unless you choose to lift the ban.  Your htaccess file helps in the removal process, or you can simply select the IP from a drop down page in the IP Deny Manager and manually lift the ban.   
One of the main reasons you may want to block an IP is due to the content of your site being stolen.  While the .htaccess file is a great way to prevent this activity, the cPanel also has a reliable feature that works on its own in the IP Deny Manager.