Cannot access javascript folder

I signed up and setup a small ubuntu VPS slice during the week and everything is going great so far, except one small problem.

I have two virtual hosts setup but cannot access the javascript folder for each. If i navigate to www.domain1.com/javascript or www.domain2.com/javascript i get the following message...

You don't have permission to access /javascript/ on this server.

If I rename the directory to anything else (eg: js) I can access the contents no problem. It seems to be a reserved keyword or something, even without a javascript folder i get the same message rather than a 404 message.

I removed the .htaccess files just incase that was causing it. Nope... Any idea whats going on here?


Solution 1:

Ubuntu Apache configuration already has Alias /javascript /usr/share/javascript/, see /etc/apache2/conf.d/javascript-common.conf. You could change this alias or remove this file altogether but I don't know if this breaks something else.

Solution 2:

The issue:

Web applications that use JavaScript need to distribute it through HTTP. Using a common path for every script avoids the need to enable this path in the HTTP server for every package.

This is the package that creates /usr/share/javascript alias and enables it in the Apache webserver.

Recommended fix

And that's it, you won't have any other problem with javascript directories. Another fix could be to rename /usr/share/javascript/ to /usr/share/javascript-common/, then adjust the Alias in javascript-common.conf to point to the renamed dir. Still not sure if this will affect any future update.

Another Fix:

Go to /etc/apache2/conf-available/javascript-common.conf, you will find this:

Alias /javascript /usr/share/javascript/
<Directory "/usr/share/javascript/">
     Options FollowSymLinks MultiViews
</Directory>

So you just have to comment this lines (with the # char) (is not recommend to edit directly the file in conf-enabled) to avoid the forbidden error. After that, do this:

a2disconf javascript-common
a2enconf javascript-common