HOW-TO: Setup a URL to Easily Change Email Passwords

jlandes

Verified User
Joined
Dec 1, 2005
Messages
623
Location
Lewistown, Pennsylvania, USA
Hello,

I'm relatively new to DirectAdmin and this is my first how-to here on the DirectAdmin forum. So, hopefully this little how-to will be of some use to somebody.

When you provide the URL to your users for them to change their email password, it is a URL similar to http://www.yourdomain.com:2222/CMD_CHANGE_EMAIL_PASSWORD. What this small how-to will allow you to do is setup an easier to remember URL for your users to change their password similar to http://www.yourdomain.com/password/. When your users enter this URL into their browser, it will automatically redirect them to the correct address to let them change their password.

If this sounds interesting, read on. Here's what you need to do:

  1. Login to your server as the root user via SSH.
  2. Execute the following commands to create the redirect file:
    Code:
    cd /var/www/html
    cp redirect.php password.php
  3. Open the file in your favorite editor, for example:
    Code:
    nano -w password.php
  4. Replace the line that reads:
    Code:
    header("Location: http://".$_SERVER['HTTP_HOST'].":2222");
    With the following line:
    Code:
    header("Location: http://".$_SERVER['HTTP_HOST'].":2222/CMD_CHANGE_EMAIL_PASSWORD");
  5. Save the file and exit the editor.
  6. Now, edit your server's Apache configuration file:
    Code:
    nano -w /etc/httpd/conf/httpd.conf
  7. Find the lines that read:
    Code:
    #Start DirectAdmin Settings
    Alias /config /var/www/html/redirect.php
  8. Add the following line after that:
    Code:
    Alias /password /var/www/html/password.php
    That entire section should now look similar to this:
    Code:
    #Start DirectAdmin Settings
    Alias /config /var/www/html/redirect.php
    Alias /password /var/www/html/password.php
    Alias /phpMyAdmin /var/www/html/phpMyAdmin/
    Alias /phpmyadmin /var/www/html/phpMyAdmin/
    Alias /webmail /var/www/html/webmail/
    Alias /squirrelmail /var/www/html/squirrelmail/
  9. Save the file and exit the editor.
  10. Restart Apache:
    Code:
    service httpd restart

If everything went well, you should now be able to access the change email password form by entering http://www.yourdomain.com/password/ into your browser.

If you have any questions or problems, please let me know. Once again, I hope this is useful to somebody.
 
Back
Top