Reputation: 4028
I have a website for all intents and purposes is called.
www.foobar.com
Which in my server path is /var/www/
I tried to create a new folder in /var/ called "analytics", with the hope that if I typed www.foobar.com/analytics I could access that folder. However that does not work because it is actually looking for /var/www/analytics instead of /var/analytics
So how can I have multiple directories mapped to a URI?
For phpmyadmin I can access www.foobar.com/phpmyadmin with the phpadmin folder is in a completely different directory. So it must be possible. However I tried googling but could not find any answers so I guess I do not have the right description of what this functionality is on Apache webservers.
Any help would be appreciated.
Upvotes: 0
Views: 302
Reputation: 2195
You have to create virtual directories in Apache. If you are using Apache2, then can you go to the directories /etc/apache2/sites-available and /etc/apache2/sites-enabled.
You have probably only the default virtual directory enabled. You can make a copy of a virtual directory in the map /sites-available. A virtual directory starts with specifying what the root directory is.
Then can you use the commands a2ensite and a2dissite in order to enable or disable the virtual directories respectively. After a change in enabled/disabled virtual directories do you need to restart/reload the apache server.
If you use .htaccess file, do not forget to set AllowAccess (in the tag Directory) to at least FileInfo or .htaccess will be ignored.
If you want to make those directories different hosts, then can you make aliases in /etc/hosts. On my home computer have I aliases for the ip addresses 27.0.0.1 and 27.0.1.1. That gives me the possibility to have two different sites at the same time.
Upvotes: 1