Reputation: 2563
I am trying to do this:
http://somehost.net/edit.php?url=http://www.youtube.com/watch?v=EgHY53dOZ-U
Forbidden
You don't have permission to access edit.php on this server.
Is there a way to fix this through javascript(jquery), cause I am passing argument through ajax call.
I have tried it this way but without success:
$('#videofrm').load('edit.php?url='+encodeURI($(this).siblings('a').attr('href'))
Upvotes: 0
Views: 1288
Reputation: 385395
If you don't have permission to access edit.php
, then it doesn't matter how many different ways you try to request it: you don't have permission.
Fix the permissions on the server, likely using chmod
if the server is on Linux.
Update
You have a server configuration issue. I can only replicate the problem when passing the string ://
inside the querystring.
Try writing AllowEncodedSlashes On
in your httpd config, as per this question/answer.
You will then need to make sure you encode your URI properly:
http://somehost.net/edit.php?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv=EgHY53dOZ-U
(it looks like your encodeURI
call should take care of that part)
AllowEncodedSlashes
allows slashes to be present in the query string as long as they're encoded which, for some reason, is not the case by default. The docs say that failure produces a 404, not a 403, but I still think that this is the cause.
If you are not able to manipulate configuration options for your webserver, workarounds include:
http://
like http!!!
that you will programmatically revert in the PHP script;http://
(as opposed to, say, ftp://
or some local path), just leave it off the query string entirely and prepend it to the input in your PHP script (preferred workaround).Hope that helps.
Upvotes: 0
Reputation: 12904
You should fix the chmoding issues on the server.
What your edit.php doing ? If it redirecting to somewhere else ? then echo the result url before redirecting.
You can follow Tomalak Geret'kal if you want/can rewrite the .htaccess. otherwise you need to pass the url without the http://
part and prepend an http://
on edit.php
Upvotes: 1