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

February 23, 2018 124 views
Apache Ubuntu 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.

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.

Have another answer? Share your knowledge.