If you’re a hostmoster or bluehost customer this might come in handy.
I created a domain for my son, we’ll call it 123mydomain.com, and then setup an email account for him. Being the teenager that he is, his mom and I wanted to have a little bit of control and therefore did not want him to have the ability to change his password, manage forwards or manage filters.
I showed him how to get to his mail via mail.123mydomain.com but this presents him with a screen giving access to all the bits and pieces that I don’t want him to have access to. The other problem is I want him to use a particular email client rather than having a choice. This is a bit selfish on my part but if I don’t limit what he can use then he’ll come asking all sorts of questions about the different clients …. If I can force the use of one (e.g. the same one his mom and I use) then it’s easier to provide “support”.
I searched and searched but couldn’t find any options to override this behavior so I called the hostmonster support folks who, I will say, are always nice and helpful but this time, unfortunately, offered a solution that was not acceptable for me. Basically the suggestion was to install Roundcube using Simplescripts and then tell my son to use that URL for his mail. That’s all fine and good but he already knew about the mail.123mydomain.com address and it was too late to take that back so I needed another option. Since hostmonster didn’t have any good alternative solutions I had to come up with something different.
What I decided to do was create a very simple php script that I could use to redirect my son directly to the mail client I wanted him to use without his ever being presented with that default landing page that was causing me so much grief.
Here’s how I did it.
- Create a directory in www root for the target domain called mail
- e.g. www.123mydomain.com/mail
- Set the folder permissions so it is accessible
- I set mine to 755
- Create a php script with a header redirect
- Save the script as index.php in your newly created mail directory
- Set the permissions so the script can be executed
- I set mine to 755
- Create a sub-domain called mail for your target domain
- Set the document root to your mail folder
Now navigating to mail.123mydomain.com overrides the default behavior and directs us to our php script which then redirects us to whatever mail client we pointed to. In this instance I chose to use Squirlmail but if you want to use Roundcube or Horde then copy the link location from the landing page and use that link in your php file instead of the example used here.