开发者

how to set custom destination properly in drupal url

I'm trying to place the destination in a drupal path like this:

http://myhost/root-folder/node/100/delete?desti开发者_StackOverflownation=node/150?nid=300

It's a little bit unusual in terms of drupal terminology, but this is my requirement.

When I visit the above url it's shows me a delete button and a cancel link. But when I click on the cancel link, the redirected page url becomes like this:

http://myhost/root-folder/node/150%3Fnid%3D300

instead of

http://myhost/root-folder/node/150?nid=300

i.e. myhost = localhost

This means it's replacing the ? with code %3F and = with %3D.

How can I avoid this issue?


That's actually totally correct, the second ? is after the query string identifier (i.e. the first ?), so it has to be url encoded to remain valid.

Don't worry about it though, when Drupal performs it's redirects by using the drupal_get_destination() function it decodes the encoded string and will redirect to the correct path.

Try putting a few different URLs in this online tool and you'll see what they are supposed to look like when they're encoded properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜