How to enable access temporary URL in CPANEL WHM

How to enable access temporary URL in CPANEL WHM? The temporary URL is used when your domain name is in the propagation period, when you’ve just migrated from a different hosting provider or uploaded a test page to see how it looks on the web before you switch DNS. You can enable/disable some option available in WHM.

This will allow users access to view their sites by entering their server hostname followed by a tilde(~) and the website owner’s username. (Example: http://servername.com/~username.)


Please take note before doing this. Why do we not recommend cPanel temporary URLs?

My primary focus is on security and performance of servers. As a result, i personally do not recommend or enable the ‘mod_userdir’ module in Apache and do not encourage customers to use cPanel temporary URL, due to these reasons:

# Due to the security issues related to mod_userdir module, enabling it in the server is found to increase the risks of attacks on the server.
# As temporary URLs expose usernames, they make the accounts more vulnerable to hacks.
# It is difficult to track the bandwidth usage into the correct user account while using cPanel temporary URLs to access the sites.
# Since running mod_userdir happens as the nobody user instead of the account user, the files and scripts created would be under user nobody and hence prone to attacks.

So, what can we do? Any work around to temporarily access your site?

Answer is very simple to enable users to test their websites temporarily, by helping them to locally resolve their domains. By editing the hosts file on user workstations to point the domain name to the IP address, users are able to access and test their websites using the domain name and make suitable changes, before making them live.

I do hope you understand all the above. Now below are the steps you will need to take to enable access temporary URL in WHM.

Step 1 : Disable mod_ruid2, mod_itk, and mod_passenger
# Navigate to WHM’s EasyApache 3interface (Home >> Software >> EasyApache 4).
# Select the profile that you wish to modify.
# Click the gear icon that corresponds to your selection.
# Click Next Step in the PHP Version stage.
# Perform one of the following actions in the Short Options List stage:
* To uninstall the mod_ruid2, deselect mod_ruid2.
* To uninstall the mod_itk, deselect mod_itk.
* To uninstall the mod_passenger, deselect mod_passenger.
# Click Save and Build at the bottom of the Short Options List interface.
# After the EasyApache build completes, use the Configure PHP and suEXEC interface to set the PHP 5 Handler option to suphp.

Step 2 : Installation of Mod SuPHP
If your most recent EasyApache build does not include suPHP, perform the following steps to install suPHP:

# Navigate to WHM’s EasyApache 3interface (Home >> Software >> EasyApache 4).
# Select the profile that you wish to modify.
# Click the gear icon that corresponds to your selection.
# Click Next Step in the Apache Version stage.
# Click Next Step in the PHP Version stage.
# Perform one of the following actions in the Short Options List stage:
* To install the suPHP PHP handler, select Mod SuPHP.
# Click Save and Build at the bottom of the Short Options List interface.
# After the EasyApache build completes, use the Configure PHP and suEXEC interface to set the PHP 5 Handler option to suphp.

Step 3 : Enable SuPHP as php handler
# Navigate to WHM’s MultiPHP Manager (Home >> Software >> MultiPHP Manager).
# Select the PHP Handlers to modify.
# Click edit under the action column
# Select suphp and click apply

Step 4 : Enable PHP open_basedir
To enable the open_basedir tweak, perform the following steps:

# Select the Enable php open_basedir Protection checkbox.
# Select the checkboxes that correspond to the domains that you wish to exclude.
# Click Save.

Step 5 : Enable Apache mod_userdir
When accessing the account through the ~user URL, you will need to make sure mod_userdir is enabled in apache.
To enable mod_userdir access, perform the following steps:

# Select the Enable mod_userdir Protection checkbox.
# To enable mod_userdir functionality for specific hosts, select the appropriate Exclude Protection checkboxes.
# To only allow mod_userdir functionality for specific additional users to access these hosts, enter their usernames in the Additional Users text box.
# Click Save.

Done, you are set to go!

2 Replies to “How to enable access temporary URL in CPANEL WHM”

  1. Nice article but still cant connect to temporary URL… Do we have to reboot server after disabling mod_userdir Protection?

Leave a Reply

Your email address will not be published. Required fields are marked *