: Forbidden 403 for js file on localhost? apologies if this isn't the right place to post this. I posted it on Stack Overflow and a user suggested I put it here. Anyway, I've looked all over
apologies if this isn't the right place to post this. I posted it on Stack Overflow and a user suggested I put it here.
Anyway, I've looked all over google and the site and none of the solutions I've tried have worked... maybe my problem requires something a little more specific.
When I have this site hosted on a test site, it works fine, but when I try to view it on my localhost site, I'm getting this error when I use "Inspect Element" on Chrome:
Failed to load resource: the server responded with a status of 403 (Forbidden)
I can tell the jquery file isn't being accessed properly by my site because the jquery that works perfectly on my Go Daddy test site (a cool little tool called Tablesorter) isn't working anymore.
The jquery.min.js file is in a directory called js. Here's the entirety of the head in my html file.
<head>
<title>Corporate Dude, Data Management</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<link rel="stylesheet" type="text/css" href="style.css?v=1.9"/>
<script type="text/javascript">
$(document).ready(function()
{
$("#data_table").tablesorter();
}
);
</script>
</head>
The weird thing is that when I move the style.css file into the js directory and change the path to js/style.css, the css works just fine. Does this mean it's not a permissions issue or is it just a peculiarity of the way href works in the link tag?
I've tried going to the terminal and typing cd /Users/myusername/mylocalhostfile/"Corporate Guy"/js then typing chmod 0755 to give permission to access the directory, but that didn't work either. Is this the proper way to assign permissions through the terminal?
Thanks for any help you can give me.
More posts by @Berryessa370
1 Comments
Sorted by latest first Latest Oldest Best
Folder and File Permissions and Ownership
It sounds like you are having ownership problems rather than file permissions. Doing a chmod 0755 will do the following:
Owner: Write - Read - Execute
Group: Read - Execute
Public: Read - Execute
Which should allow users to read the directory however it doesn't necessary mean that files can be read or written to by Apache or whatever web server you are using because you haven't used the -R option that will recursively change folders and file premissions. You should be able to fix this problem with ease, simply follow the below steps.
Change ownership of the website folder to that of your web server process (This case Apache).
chown -R www-data:www-data /home/$USER/public_html
Then you can add yourself to the group www-data by doing:
adduser $USER www-data
Changing folder and folder permissions
chmod -R 775 /home/$USER/public_html
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.