Question

How do I create an directory alias for use on my website?

Posted February 23, 2018 861 views
ApacheUbuntu 16.04

I’m brand new to DO and linux and I’ve been looking for a while and still am not able to sort this out.

I need to create a virtual directory/shortcut/alias etc to use on the website so that www.website.com/docs/ points at the resources at /var/www/html/ifiles.

Thanks for the noob help in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

In Apache that’d be “Alias /docs /var/www/html/ifiles”

  • I tried that before posting but thought I had picked the wrong command as I got an error saying:

    “Alias: command not found”

    I also tried alias /docs /var/www/html/ifiles and got 2 different errors saying:
    alias /docs: not found and alias /var/www/html/ifiles: not found.

    I also checked the ~/.bashrc file and used the same syntax for an alias as is in my file - i.e. alias docs=’/var/www/html/ifiles’. That took without errors but doesn’t help on the website as that’s where I need the shortcuts to work.

    I’m clearly missing a step but am not sure what that step might be. I even checked the bash site an that didn’t help.

Thanks for the input but I was asking the wrong question. I did need an alias but for apache. A little more digging and I was able to get that working.

Thanks again for your time and patence.

Submit an Answer