0

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'))
7
  • Have you tried to fix the permission issue yet? Commented May 6, 2011 at 11:32
  • I gave you a website with urlEncode function.. try using that one. Thereby, what does the page says if you load it without any $_GET parameters? Commented May 6, 2011 at 11:32
  • 1
    can you post the part that processes $_GET['url']? Commented May 6, 2011 at 11:52
  • btw it's encodeURIComponent not encodeURI for this kinda stuff Commented May 6, 2011 at 11:53
  • @daniel.tosaba: What does the edit.php does? Commented May 6, 2011 at 11:54

2 Answers 2

1

You should fix the chmoding issues on the server.

Edit

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

Sign up to request clarification or add additional context in comments.

8 Comments

It's a bit premature to conclude that it's simply a filesystem permissions issue.
why would i fix anything? if i put some other format variable like url=stackoverlow everything works just fine
You should mention the same in your question too
if the url have the http:// at the begening then only it shows 403 and 404. Hope you got the hint
how would you fix it, without taking http part off?
|
0

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:

  • Choosing a stand-in term for http:// like http!!! that you will programmatically revert in the PHP script;
  • If you always use 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.

6 Comments

why would i fix anything? if i put some other format variable like url=stackoverlow everything works just fine
@daniel.tosaba: I find that unlikely, unless edit.php performs an HTTP redirect. Does it?
it does not. it just needs given data so it can do some database stuff
@daniel.tosaba: That's remarkable. To solve this, we'd need to know exactly what your edit.php is doing, and about any .htaccess definitions you may have. We just don't have enough information.
thank you very much for valuable answer. i've just found out that my type of account doesn't allow this, so i will have to do some trickery job. thanks again!!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.