Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

summary

In this tutorial you will find out about the .htaccess file and the power it has to improve your website. We supports .htaccess files however as a customer you are responsible for what is in this file and how it changes your site. 

 

creating a .htaccess file

You can create a .htaccess file on your local computer or on the server.

on your computer:

Windows: Using Notepad save the file as .htaccess

Mac OS X: Using TextEdit save the file as “.htaccess”
Note: If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder.Using your preferred FTP client upload the file to the server. The .htaccess file will need to be in the folder where your site is located, typically the public_html folder.

on the server

  1. Login to your cPanel Account
  2. Click the File Manager icon, located in the Files section.
  3. From the File Manger popup choose “Choose Hidden Files (dotfiles).”
    Note: If you do not see this popup you will need to click the “reset all interface settings” link at the bottom of the cPanel page.
  4. From the File Manager popup choose the folder you would like to open, most often the “Web Root (public_html/www)”
  5. Click the Go button.
    Note: If you are in the File Manager already you can add &showhidden=1 to the end of the URL.
  6. Click the New File icon to create a new file and name it .htaccess

alternative index files

You may not always want to use index.htm or index.html as your index file for a directory, for example if you are using PHP files in your site, you may want index.php to be the index file for a directory. You are not limited to ‘index’ files though. Using .htaccess you can set foofoo.blah to be your index file if you want to!

Alternate index files are entered in a list. The server will work from left to right, checking to see if each file exists, if none of them exist it will display a directory listing (unless, of course, you have turned this off).

 

DirectoryIndex index.php index.php3 messagebrd.pl index.html index.htm

 

custom error pages

You can customize your own, personal error pages (for example when a file is not found) instead of using Bluehost’s error pages or not having an error page. This will make your site seem much more professional.

You can use custom error pages for any error as long as you know its number (like 404 for page not found) by adding the following to your .htaccess file:

ErrorDocument errornumber /file.html

For example if I had the file notfound.html in the root directory of my site and I wanted to use it for a 404 error I would use:

ErrorDocument 404 /notfound.html

If the error page is not in the root directory of your site, you can enter the path to the file:

ErrorDocument 500 /errorpages/500.html

These are some of the most common errors:

            401 - Authorization Required
            400 - Bad request
            403 - Forbidden
            500 - Internal Server Error
            404 - Wrong page

stop a directory index from being shown

Sometimes, for one reason or another, you will have no index file in your directory. This will, of course, mean that if someone types the directory name into their browser, a full listing of all the files in that directory will be shown. This could be a security risk for your site.

To prevent against this (without creating lots of new ‘index’ files, you can enter a command into your .htaccess file to stop the directory list from being shown:

# disable directory browsing
            
            Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
            
            # enable directory browsing
            Options All  Indexes

deny/allow certain ip addresses

To only allow people with specific IP addresses to access your site (for example, only allowing people using a particular network to get into a certain directory) or you may want to ban certain IP addresses (for example, keeping disruptive members out of your message boards).This will only work if you know the IP addresses you would like to ban.

Please keep in mind that most ISP’s use dynamic IP addresses, so this is not always the best way to limit/grant access.

 

block an ip address

#Deny List
            
            order allow,deny
            deny from 123.123.123.123 #specify a specific address
            deny from 123.123.123.123/30 #specify a subnet range
            deny from 123.123.* #specify an IP address wildcard
            allow from all

allow an ip address

#Allow List
            
            order allow,deny
            allow from 123.123.123.123 #specify a specific address
            allow from 123.123.123.123/30 #specify a subnet range
            allow from 123.123.* #specify an IP address wildcard
            deny from all
            

Note: This will still allow scripts to use the files in the directory. 

redirection

There is a tool in the cPanel that can create the Redirects for you.

redirect from a specific file to a new file

Example:

Redirect /redirect_from.html http://www.newsite.com/folder/redirect_to.html

In the above example, a file in the root directory called redirect_example.html is redirected to the URL http://www.newsite.com/folder/redirect_example.html
If the old file were in a subdirectory then you could use:

/subdirectory/redirect_from.html

wildcard redirect / redirecting from one folder to a new folder

Redirect /redirect_from http://www.newsite.com/redirect_to

Now any request to your site below /olddirectory will be redirected to the new site, with the extra information in the URL added on, for example if someone typed in:

http://www.example.com/redirect_from/images/image.gif

They would be redirected to:

http://www.newsite.com/redirect_to/images/image.gif

redirecting (url rewriting) with joomla

To enable URL Rewriting in Joomla you will need to copy and paste the following code into your .htaccess file.

            # For security reasons, Option followsymlinks cannot be overridden.
            #Options  FollowSymLinks
            Options  SymLinksIfOwnerMatch

password protection

One of the many uses of the .htaccess is being able to reliably password protect directories on websites.
Note: If you would like to use the cPanel tool to password protect your folders please see our article: Password Protect a folder on your website

the .htaccess file

Adding password protection to a directory using .htaccess takes two stages. The first part is to add the appropriate lines to your .htaccess file in the directory you would like to protect. Everything below this directory will be password protected:

AuthName "Section Name"
            AuthType Basic
            AuthUserFile /home/username/.htpasswds
            Require valid-user 

There are a few parts of this which you will need to change for your site. You should replace “Section Name” with the name of the part of the site you are protecting e.g. “Members Area”.

The /home/username/.htpasswds should be changed to reflect the full server path to the .htpasswds file (more on this later). If you do not know what the full path to your webspace is, check your Bluehost cPanel. Look on the left “stats” column of the cPanel.

the .htpasswds file

Password protecting a directory takes a little more work than any of the other .htaccess functions because you must also create a file to contain the usernames and passwords which are allowed to access the site. These should be placed in a file which (by default) should be called .htpasswd. This can be placed anywhere within you website (as the passwords are encrypted) but it is advisable to store it outside the web root (in your home directory) so that it is impossible to access it from the web.

entering usernames and passwords

Once you have created your .htpasswd file (you can do this in a standard text editor) you must enter the usernames and passwords to access the site. They should be entered as follows:

username:password

Where the password is the encrypted format of the password. There is a good username/password service at the KxS site which will allow you to enter the username and password and will output it in the correct format.

For multiple users, just add extra lines to your .htpasswd file in the same format as the first.

accessing the site

When you try to access a site which has been protected by .htaccess your browser will pop up a standard username/password dialog box. Alternatively you can send the username and password (unencrypted) in the URL as follows:

            http://username:password@www.website.com/directory/ 

As a Server Administrator, I want the ability to clone a cPanel server to a new setup, so that deployment of new servers is simplified and quicker.

Cloning should include:

 

  • Tweak Settings (i.e. /var/cpanel/cpanel.config)
  • Exim Configuration
  • Feature Lists
  • Packages
  • Custom EasyApache Profiles
  • Reseller ACLs
  • Statistics Software Configuration
  • Update Preferences
  • /var/cpanel/rpm.versions.d
  • Other settings to be defined

 

Cloning should explicitly exclude:

  • IP Addresses
  • Nameservers
  • Hostname
  • cPanel Accounts
  • Anything that is server-specific

To Bakcup :

# /usr/local/cpanel/bin/cpconftool

/usr/local/cpanel/bin/cpconftool [–restore=file|–backup|–list-modules] [–modules=MODULE,MODULE,MODULE]

# /usr/local/cpanel/bin/cpconftool –backup

Backup Successful

To Restore :

/home/whm-config-backup-all-1.1-1373690794.tar.gz

IF IP got banned by CPHulk few times and it is really not a pleasant thing knowing that you need to access your server but you just can’t because CPHulk blacklisted your IP.

Great way around it is to white list your IP address in front so you don’t end up in that situation. It’s quite easy, all you need to do is to login at SSH and execute this lines:

1
2
cd /scripts
./cphulkdwhitelist xxx.xxx.xxx.xxx

Just don’t forget to replace xxx.xxx.xxx.xxx with your IP address.

Here’s the proper way to clear the exim mail queue on a cpanel server.

/etc/init.d/exim stop;
sleep 10;
killall -9 exim eximd
sleep 5;

#clean out the mail queue
find /var/spool/exim -mindepth 2 -type f -exec rm -rf {} ;

#clean out the mail db files
find /var/spool/exim/db -type f -exec rm -rf {} ;

#reset the eximstats database tables
echo “truncate table sends;” | mysql eximstats
echo “truncate table defers;” | mysql eximstats
echo “truncate table failures;” | mysql eximstats
echo “truncate table smtp;” | mysql eximstats

/etc/init.d/exim restart

To create a new account go to

WHM >> Account Functions >> Create a New Account.

After new account is created end-user will be able to access his/her own control panel at http://serverIP/cpanel/, username and the password will be the same as you will specify on the new account creation page.

There are many ways that you can transfer files and folder to and from your hosting account. We highly recommend using an FTP (File Transfer Protocol) program to quickly upload and download files.

general ftp information

The best way to upload your web site is via FTP. This can be done in a number of different ways using many different FTP clients. Every client needs 4 things: 

  1. Domain name or IP Address, which will be used in the “FTP address” field.
  2. Username, will be the same as cPanel or the FTP account created.
  3. Password, will be the password you set up to go with the cPanel or FTP username.
  4. Port, is usually port 21.

The files for your site main site will need to be uploaded to the public_html folder.

In cPanel, it is very simple to limit access to a directory on your server. This can be used to require a password in order to visit a website or to limit access to a certain directory of files accessible over the web. To set up a password for a folder:

  1. Click Password Protect Directories from the Security section.
  2. Select either the document root or the web root directory and click Go.
  3. In the next window, select the folder you wish to password protect. (You can also do this by going into File Manager and right clicking on the appropriate folder.)
  4. Follow the directions on the Password Protect Directory page to change the security settings for the folder and create authorized users.

If you would like to check the number of files, disk space or how much bandwidth you are using on your Reseller account, you can do so from your WHM panel.

View Disk Space per cPanel

You can view the disk space allotment and usage for a specific account by doing the following:

  1. Log into WHM.
  2. Click on Account Information.
  3. Click on List Accounts.

The allotments for each cPanel account will be listed in the Quota and Disk Used columns.

View Disk Space for the Entire Reseller Account

If you are wanting to see the total amount of disk space for your entire Reseller account:

  1. Log into WHM.
  2. Click on Account Functions.
  3. Click on Create New Account.

At the bottom of the page, under Account Creation Resource Information, the total disk space and bandwidth for the entire Reseller account will be listed along with the amounts allotted per package.

View Bandwidth Usage

To view your bandwidth usage per cPanel or for your entire Reseller account, you can do so by doing the following:

  1. Log into your Reseller WHM Panel.
  2. Click on Account Information.
  3. Click View Bandwidth Usage.

when you go to “create a New Account” on the right side you should see the current space and bandwidth usage.

Entire accounts can be backed up by doing the following:

  1. Go to ‘backup’, under the ‘Site Management’ header in cPanel.
  2. Underneath where it says “Full Backups”, click on the link that says “Generate/Download a Full Backup”
  3. Select which method you wish to use, whether you want to copy the backup directly to another ftp server, or if you wish to generate the backup in your home directory of your account with us. If you don’t know which to choose here, the first one (Home Directory) is usually the best choice
  4. Enter an email address.
  5. Only answer the other two questions if you are backing up to another FTP server.
  6. Press ‘Generate Backup’.
  7. When you get the email that the backup is finished, go into cPanel/files/legacy file manager
  8. Select the root folder /
  9. Select the backup and then click download in the right side menu
  10. When you have the file on your PC, delete the backup in the same menu

You have now successfully backed up your full cPanel account (not your customers if you are a reseller). cPanel will mail you when your backup is complete.

To create a MySQL database and user, log into the cPanel interface for the desired domain and click on MySQL Databases under the Databases section.  At the next page, enter the new database name under the Create New Database field to create a new database. You can create a new user by specifying one under Add New User.

To make sure that the MySQL users have access to specific MySQL databases, you can link them at the bottom of the page under Add User to Database.  The next screen will allow you to grant privileges for the MySQL user to the database you selected.

To connect to a database and administer it, you can use phpMyAdmin. You can access this by clicking the icon of the same name in the Databases section of cPanel.

All cPanel servers come with self-signed certificates configured to secure the control panel as a default feature. Self-signedSSL certificates are the cause of this warning. Since SSL certificates are only valid for the domain(s) they are purchased for, the majority of our reseller clients that wish to offer cPanel control panel access to their customers without the certificate warning purchase a signed certificate from a major authority (GeoTrust, Comodo, etc.) for the hostname of theirVPS server. (ServInt customers can purchase trusted certificates and have them installed from ServInt directly via the customer portal.)

Once a trusted certificate is installed, cPanel can be configured to redirect all requests to the SSL port, and redirect all access to the hostname of the server. Therefore, if you purchase a certificate for the hostname of your VPS server (typically vps.xxxx.com), the control panel can be configured to route all requests to this domain, and thus secure all access to the control panel without the SSL warning.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.

Click on the “Tweak Settings” link under “Server Setup”. Within the “Mail” section is a text box with the heading:

“The maximum each domain can send out per hour (0 is unlimited):”

Change the value and apply the changes by clicking on the “Save” button at the bottom of the page.