How to add custom directory e.g. phpmyadmin?

Edit your Apache config file and add an Alias Directive. For example, let's use the default file.

sudo -e /etc/apache2/sites-available/default

Make your alias by adding a section within the VirtualHost directive:

Alias /database/ "/usr/share/php5/phpmyadmin/"
<Directory "/usr/share/php5/phpmyadmin/">
    Order allow,deny
    Allow from all
    # New directive needed in Apache 2.4.3: 
    Require all granted
</Directory>

Save and restart: sudo /etc/init.d/apache2 restart

Or for the other reference:

sudo -e /etc/apache2/sites-available/default

And the contents...

Alias /myportal1/ "/media/my/web/portal1/"
<Directory "/media/my/web/portal1/">
    Order allow,deny
    Allow from all
    # New directive needed in Apache 2.4.3: 
    Require all granted
</Directory>

Save and restart: sudo /etc/init.d/apache2 restart

Add more directives within the Directory directives, such as

Options Indexes FollowSymLinks 

See http://httpd.apache.org/docs/2.2/mod/core.html#directory

That what you were after?


A simpler alternative is to create a soft link from the document root. For example, if the document root is "/var/www" (the default on most Linux systems), then the following command does the trick:

sudo ln -s /media/my/web/portal1 /var/www/myportal1

This works immediately - you don't even need to reload the Apache server.

Tags:

Lamp

Apache2