2

I mean can we have something like this? url with double ? in drupal?

http://drupal.org/?destination=xxx/yyy?token=zzz

2 Answers 2

8

Sort of, but you'll need to URL encode the second ? otherwise the URL will be invalid.

The best thing to do is use l() or url() which will do this for you:

$query_string = array('destination' => 'xxx/yyy?token=zzz');
$url = url('<front>', array('query' => $query_string));

That will produce the string:

/?destination=xxx/yyy%3Ftoken%3Dzzz

Which is the correctly encoded version of the URL in your question.

Drupal will also respect this method when auto-redirecting based on a form submission etc. So the page you get directed to will actually look like this:

/xxx/yyy?token=zzz
-1

You can do it like this:

http://drupal.org/?destination=xxx/yyy&token=zzz

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.