HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Redirect webmail.domain.com to mail.domain.com/squirrelmail (http://www.howtoforge.com/forums/showthread.php?t=58257)

breauxlg 14th August 2012 18:51

Redirect webmail.domain.com to mail.domain.com/squirrelmail
 
I know this is probably very simple and I'm just not getting it, but I want my users to be able to type in webmail.domain.com and have ispconfig3 redirect to mail.domain.com/squirrelmail. I love squirrelmail, but I've had to answer one too many questions about the name. I can do the cname pointing, but don't know how to make Ispconfig3 handle it.

tahunasky 15th August 2012 05:18

For CentOS 6.3 what i have done, is when a user types in mail.domain.com (or mail.domain1.com, mail.domain2.com etc) it goes to roundcube, but can be the same for squirrelmail.

Create a DNS mail CNAME record for each domain you want to redirect the subdomain mail to squirrelmail. I think ispconfig automatically makes an A record for mail, but if you are going to the same IP address i prefer the CNAME as if i change the IP address i dont need to change every subdomains records IP address, just the main domain A record..

SO in DNS create the CNAME record.

Code:

   
CNAME        mail        domain.com.

then create a file as below:

/etc/httpd/conf/sites-available/_default.vhost
Code:

 
<VirtualHost *:80>
    ServerName mail.domain.com
    ServerAlias mail.*
    DocumentRoot /usr/lib/squirrelmail
    ServerAdmin webmaster@domain.com
# put the below 3 lines if you require SSL connectiom
    RewriteEngine  on
    RewriteCond    %{HTTPS} !=on
    RewriteRule ^mail(.*) https://mail.{HTTP_HOST}
</VirtualHost>

# the below section is only need if you have above 3 lines and want SSL
<VirtualHost *:443>
    ServerName mail.domain.com
    ServerAlias mail.*
    ServerAdmin webmaster@domain.com
    DocumentRoot /usr/lib/squirrelmail
   
    SSLEngine On
    SSLCertificateFile /usr/local/ispconfig/interface/ssl/ispserver.crt
    SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key
 </VirtualHost>

then i create a link to the /etc/httpd/conf/sites-enabled/ directory:

Code:

ln -s /etc/httpd/conf/sites-available/_default.vhost /etc/httpd/conf/sites-enabled/000-default.vhost
this way it doesnt matter what domain is used, if the put in the mail subdomain they will all go to the same place, and any new domains you add with the mail subdomain will also be sent to squirrelmail without any extra configuring.

fbartels 15th August 2012 08:29

The cheapest trick probably would be to put this php file into the directory of webmail.domain.com. This way your customer will be automatically redirected to http://mail.domain.com/squirrelmail

Code:

<?php
header("Status: 301 Moved Permanently");
header("Location:http://mail.domain.com/squirrelmail");
exit;
?>


Sir Henry 15th August 2012 12:57

I think he does not even want his users to know where the redirection goes to.

With ISPConfig this issue is as simple as creating a site domain.com and a subdomain mail.domain.com with a proper redirect. If the real files are outside the web directory you could solve this with a symbolic link. You will then also have to add the real path to the PHP open_basedir in the Options tab.

breauxlg 21st August 2012 20:24

Now squirrelmail doesn't even come up
 
Now, when I goto squirrelmail, I get this box that pops up:
You have chosen to open

which is a: application/x-httpd-suphp (671 bytes)
from:www.domainname.com

What should Firefox do with this file?

fbartels 21st August 2012 21:24

you have been presented three different ways to achieve what you want. Which way have you chosen?

tahunasky 22nd August 2012 02:33

It could be an error from rewriting the address... What have you done ?

I would try this in the squirrelmail.conf or what ever other file you have used with the alias:

Code:


Alias /webmail /opt/squirrelmail
Alias /sm /opt/squirrelmail

<Directory /opt/squirrelmail>
  Options +FollowSymLinks
  Order allow,deny
  allow from all

  RewriteEngine  on
  RewriteCond    %{HTTPS} !=on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Directory>


Sir Henry 26th August 2012 15:36

Quote:

Originally Posted by breauxlg (Post 284014)
Now, when I goto squirrelmail, I get this box that pops up:
You have chosen to open

which is a: application/x-httpd-suphp (671 bytes)
from:www.domainname.com

What should Firefox do with this file?

You have to enable suPHP for the directory, see this article for a similar issue.


All times are GMT +2. The time now is 05:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.