I have put some javascript into my web site. it works just fine if I leave the *js files in the root of my website. but I wanted to put the javascript files in a folder (directory) called javascript. when I do that the scripts will not work. any suggestions on how to make the javascript work when in the new directory ? I have tried ./javascript/javascript.js /javascript/javascript.js and javascript/javascript.js I am sure it is a permissions problem with my ubuntu 10.10 perfect server running apache 2.2.16 . I still don't understand something, sorry
Do you get a error message when you open http://www.yourdomain.tld/javascript/javascript.js in a browser? If yes, which error do you get and which error is logged in the error.log file of the website?
Error I get an error 403 , and the javascript does not work. if I put the script into the website directory the javascript works,, go figure
No Clue I have not a clue of what you speak, what package ?? this is how I call the javascript <script type="text/javascript" src="accordion.js"></script> if I need more somewhere, I don't know where it is. thanks for the answer
Are there any errors in Apache's error log? What are the permissions of the folder where you put the script? Is it inside the document root?
is the html file that calls the .js in the javascript folder or in some other folder. If it is just in the root then you need to: <script type="text/javascript" src="javascript/accordion.js"></script> If it is another sub folder just like javascript then you need to try: <script type="text/javascript" src="http://www.yourdomain.com/javascript/accordion.js"></script> Also if that does not work, then put a html file in the javascript folder and see if you can reach it, so as to determine if it is a permissions issue in general or just with .js files.
ooops I was not clear <script type="text/javascript" src="javascript/accordion.js"></script> is what I did at first, the javascript file was in a subdirectory of the website called javascript. When I put the accordion.js and jquery.js in the same directory as my web site it all works, but as soon as I try to use the javascript folder then nothing works and I get a 403 error. I had a somewhat the same problem with a cgi script that I never got to work. I am sure I have something wrong with my settings on website , just don't know where to look
Are there any errors in Apache's error log? What are the permissions of the folder where you put the script? Is it inside the document root?
/var/www/clients/client1/web1/web is document root is where I want to put the javascripts /var/www/clients/client1/web1/web/javascript permissions are 755 currently on the javascripts directory
What are the outputs of Code: ls -la /var/www/clients/client1/web1/web/javascript/ and Code: ls -la /var/www/clients/client1/web1/web/ ?
did the requested here is the results of your request, where can I go on the internet to be able to figure out what all that means ?
That is just a directory listing run Code: man ls To get more info on what each of the fields are. That all looks ok, although you shouldnt need 777 permissions on those js files, the server does not need to execute them, only serve them. Here is mine... Code: -rw-r--r-- 1 web2 client2 3379 Feb 14 14:17 main.js I recommend that you chmod those files 644 but thats unlikely to fix your problem. It's not something daft like an alias declaration in apache for /javascript or something? As one of the other members said, you need to look at the apache error logs for more clue.
if i understood correctly, you want to have the javascript flies in /var/www/clients/clientx/webx/javascript and want to use them from /var/www/clients/clientx/webx/web then your declaration is incorrect, yours is Code: <script type="text/javascript" src="javascript/accordion.js"></script> but if my thought are right you need the ../ before the javascript .. like so Code: <script type="text/javascript" src="../javascript/accordion.js"></script>
well, great try but it still does not work. I guess I will give up on this and just do more study until I figure it out thanks for the help
Your /var/www/clients/client1/web1/web/ directory has permissions of 710 and is owned by web1:client1 which means the Apache user has no read access to it. Please try Code: chmod 755 /var/www/clients/client1/web1/web/
Thanks Falco, that did not work either, I am sure I have something wrong is setup somewhere. I will give up for not and just put the script's in the same directory as the pages. It was a good idea but I don't want to take your time anymore Thanks Tons for the help
scripts?? -solved? The javascript directory puzzle drove me nuts as well. An extensive Google search led me to the following: http://forums.anandtech.com/showthread.php?t=2055967 It turns out that in Apache 2.2 the following file: /etc/apache2/conf.d/javascript-common.conf contains: Alias /javascript /usr/share/javascript/ <Directory "/usr/share/javascript/"> Options FollowSymLinks MultiViews </Directory> When you comment this out, you can run .js scripts from the /javascript subfolder in your websites of choice... Perhaps something to add to the "Perfect..." guidelines!
OH My Goodness, what a wonderful find. Thank YOU !! so much , will try it in the am.. will change directory name and will see, that way I don't have to remove anything.
I changed my directory name to javascriptdir and all started working, thank you so much. I don't think I would have ever found that one