cPanel – create directory alias on domain

Creating aliases on cpanel server is easy – for domains. But when you want to create directory alias for files outside of document root, there is no quick/click option in control panel. By directory alias I mean for example, Where /something is directory that is outside of your document root – public_html of domain. Another example, you have domain and you want phpmyadmin to be accessible on, but phpmyadmin is installed outside of document root of You’ll need directory alias. Here is quick way to do it.

  1. Check cPanel’s Apache definition for your domain. Open configuration file /usr/local/apache/conf/httpd.conf and search for your domain in it. Then search for something like this:
    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2_2//*.conf"
  2. For example above, we would do something like this:
    # Create proper directory tree
    root@cpanel [~]#  mkdir -p /usr/local/apache/conf/userdata/std/2_2/username/
    # Move to created directory
    root@cpanel [~]# cd /usr/local/apache/conf/userdata/std/2_2/username/
    # Create new configuration file which will contain your alias configuration.
    root@cpanel []# vi
    # Add directory alias Apache definition. For example, myapplication.
    Alias /myapplication /home/username/
    <directory "/home/username/">
        AllowOverride All
        Allow from All
  3. Run cpanel script.
    root@cpanel [~]# /scripts/ensure_vhost_includes --user=username
  4. Restart Apache

That’s it, you just created directory alias. 🙂 Application should now be accessible on Cpanel won’t rewrite your settings.

Of course, don’t forget to change names in steps above according to your needs! 🙂

1 Comment

Got Something To Say:

Your email address will not be published.


I accept the Privacy Policy

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GENIOUS!!! Tks so much!! easy and simple… as it should be!! Fantastic!!

© 2022
Hosted by SIEL

About author