1

I am using drupal_goto and url methods to try and direct the user to a page.

url returns a string like "/whatever/example" and then I pass that into drupal_goto and they get sent to

localhost//whatever/example

I checked the value for $base_url in settings.php that has no trailing slash. what else could cause this behavior?

2
  • 1
    url should be whatever/example not /whatever/example
    – Aboodred1
    Commented May 8, 2013 at 16:24
  • that's what the url() method returns for me when I give it node/<nid>
    – lathomas64
    Commented May 8, 2013 at 16:25

1 Answer 1

4

Whatever you pass to drupal_goto() will in turn get passed on to the url() function. If you're using url() on the path before hand, it'll get run through again and you'll get a double slash.

You can just pass the router path to drupal_goto() directly, and it will handle the alias for you:

drupal_goto('node/1234');

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.