404 on javascript and css resources

  • Posted January 9, 2015


I’m migrating from shared hosting, and trying to test my site on the new DO VPS. When I go to my new IP address, the site loads, but the following resources get a 404 error:

<link href="/javascript/jquery-ui-1.9.2.custom/css/smoothness/jquery-ui-1.9.2.custom.css" rel="stylesheet">
<script src="/javascript/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"></script>
<script src="/javascript/dialog/alert_text.js"></script>

Resources in other folders are loading fine; for example, this stylesheet loads without issue:

<link rel="stylesheet" type="text/css" href="/styles/main_style.css">


I have tried deleting my browser cache, as well as using a different browser. The files do exist on the new server in that location. I’ve checked that the folder is correct, and that there aren’t any strange capitalization. Everything is working fine on the old server, and all I’ve done is copy and past to DO.

One thing to note is that I haven’t pointed my DNS to DigitalOcean yet since I’m still testing. So the client browser is loading from MY.IP.ADR.ESS/javascript/… rather than MYDOMAINNAME/javascript/…. Not sure if that has something to do with it.

Thanks for the help!


You probably have a misconfigured ‘<Directory>’ directive in you webserver config file or .htaccess file (if you’re using apache).

I’m looking at the permissions now… The /javascript directory is owned by the exact same owner and group, and has the exact same file permissions as all other folders.

When I point my browser to a different directory, say /css, I can see the contents of the directory. But when I point my browser to /javascript, I see 403 forbidden “You don’t have permission to access /javascript/ on this server.”

I think you’re right, there’s a permission problem with the /javascript folder. But I’m not sure what to change since all the folders in my root dir have the same permissions.

This should be simple… What am I missing!?

This comment has been deleted

I would look at the file systems permissions and ownerships of each path element of each problematic file being referenced, starting with the /your_web_root_here/javascript subdirectory.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

I found the issue, and it’s a known problem: Ubuntu BUG

The problem was that the folder’s name was “javascript”, and the fix was simply renaming my /javascript folder to /java-script (or anything OTHER than /javascript).

Basically if you have the javascript-common package installed, it generates the following alias:

Alias /javascript /usr/share/javascript

So my WEBROOT/javascript folder was being redirected to /usr/share/javascript, giving the 403 error.

Hope this helps save someone else a few days of troubleshooting!

I’m still struggling with this…

There are no .htaccess files on the server. And the server wouldn’t care if there were, because Alow Override None is set.

I’ve changed my apache2.conf back to the default state to make sure there are no strange <Directory> directives.

I added a <Directory> for the /javascript folder and did Require all granted.

I changed permissions on the /javascript folder to chmod 777 with no effect, then changed back to chmod 755.

I’m restarting the web server after each change, but nothing has any effect. I always get a 403 forbidden error on the /javascript directory, even though the owners and permissions are the exact same as every other directory in my web root.

Is there some way to get more info on the 403 error? Some way to find out why it’s not allowing access?

The issue is fairly straight-forward. On shared hosting, your resources are stored in a different path. Right now, you either don’t have the files downloaded, or have them in /javascript/

Let’s do this. Imagine the pathing like this:


-> javascript –> jquery-ui-1.9.2.custom —> css ----> smoothness -----> jquery-ui-1.9.2.custom.css

Now, if your files are actually stored in this tree:

-> javascript –> jquery-ui-1.9.2.custom.css

This would mean that it’s looking in the wrong place for your files.

There are 2 options:

  • create the folders like you have on the shared hosting,
  • change the files so they point to the new path