Webmail without cPanel 2 - Alternative Method

Do I have to give all my email accounts access to cpanel?
How can users access webmail without going through cpanel?
Can I create a subdomain that redirects to webmail?
How can I direct webmail.mydomain.com to Horde, or squirrelmail?
The following is an alternate method to create redirection for a subdomain to redirect to webmail client directly.

First you need to create the subdomain that you want to have redirect to your chosen or preferred Webmail client.


To do this follow these steps:



1. Login in to your cpanel interface.

2. Select the Subdomain option, and create the subdomain. (ex: webmail.yourdomain.com)

3. Once it has been created, go to the File Manager option of the cPanel.

4. Navigate to public_html by selecting the folder image beside the text 'public_html'

5. Navigate to the folder that was create by your subdomain. (in the case of the example it would be the 'webmail' folder)

6. Once inside this directory, you will either see or need to create an .htaccess file.

*if it is not there proceed to step a: (if it already exists proceed to step d)


a. create it by selecting the 'Create New File' option.

b. a menu appears in the top right corner of the File Manager interface. Choose 'Text Document' and call it:

'.htaccess' without the quotes.

c. File Manager will now refresh and you will then see your new file in the listing of that directory.

d. click on the text title for the .htaccess file on the left side of the screen, and a menu appears in the top right of the screen.

e. choose the 'Edit File' option. a new window opens.

f. add the following lines:

To Redirect to the Horde Webmail Client:



RewriteEngine on

RewriteCond %{HTTP_HOST} ^webmail.yourdomain.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.webmail.yourdomain.com$

RewriteRule ^(.*)$ http://yourdomain.com:2095/horde/$1 [R=301,L]


To Redirect to the Squirrel Mail Client:



RewriteEngine on

RewriteCond %{HTTP_HOST} ^webmail.yourdomain.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.webmail.yourdomain.com$

RewriteRule ^(.*)$ http://yourdomain.com:2095/3rdparty/squirrelmail/index.php$1 [R=301,L]


*NOTE: replace 'yourdomain.com' above with your actual domain name.*


g. go to the bottom of the page and click 'Save'

h. now go test the subdomain in your browser.


Everything should be setup and fully functional.


You can also use a secure login to the webmail as well, for the line:


RewriteRule ^(.*)$ http://yourdomain.com:2095/horde/$1 [R=301,L]


change this to:


RewriteRule ^(.*)$ https://yourdomain.com:2096/horde/$1 [R=301,L]


same applies for Squirrel Mail:


RewriteRule ^(.*)$ http://yourdomain.com:2095/3rdparty/squirrelmail/index.php$1 [R=301,L]


change this to:


RewriteRule ^(.*)$ https://yourdomain.com:2096/3rdparty/squirrelmail/index.php$1 [R=301,L]





For further help with this situation, please visit the lunarforums.


More about .htaccess can be found here:

Apache Tutorial - .htaccess Guide

More about .htaccess rewrites can be found here:

Apache URL rewriting Guide