I've got Drupal installed in a subfolder of an existing site: www.example.com/drupal/
From a non-Drupal page, I'm linking to the login link and trying to set the destination so they go back to the page they were on:
www.example.com/drupal/user&destination=http://www.example.com/not-drupal/path/to/page
But Drupal is redirecting to:
www.example.com/drupal//www.example.com/not-drupal/path/to/page
I've tried dropping the http://, but get basically the same result:
www.example.com/drupal/www.example.com/not-drupal/path/to/page
It looks like drupal_goto() is used, which sounds like it is suppose to support full URLs. I've come across a number of forum posts on this same topic, but didn't find a solution that didn't require hacking Drupal core.
Does anyone have any ideas?
Thanks!
Comments
http:// seems to be dropped at some point
I'm replicating some of the code for drupal_goto() and drupal_get_destination() in my own test script. I can reproduce the above if I omit "http://" from the destination URL. So I'm guessing that once the URL reaches drupal_goto(), "http://" has been removed. From the looks of drupal_get_destination(), I don't think this is the culprit.
What other functions are involved in this process???
Bump
+1
I'd like to know this too. We're using a Drupal site to do content management for a second site that uses an RPC to grab data from Drupal. Would like to redirect editors back to the second site after they edit the content on Drupal site.
Workaround
jfall, since only a few of my website sections external to Drupal (same domain) are using the destination parameter, I'm employing an Apache RewriteRule in the main Drupal .htaccess file.
So, here is sample link:
http://www.example.com/drupal/user/login?destination=/section/path/to/fi...
When the user logs in, they are redirected by Drupal to:
http://www.example.com/drupal//section/path/to/file.html
Thus, my RewriteRule is as follows:
RewriteRule ^section/(.*)$ /section/$1 [R,L]
And they end up at:
http://www.example.com/section/path/to/file.html
However, now I need to do this site wide, so I need to find a more sustainable option. Please post any solutions you come across.
Thanks,
Chris
Update to workaround
While I'd prefer a more elegant solution, this should work for all cases:
RewriteRule ^redirect/(.*)$ /$1 [R,L]
http://www.example.com/drupal/user/login?destination=/redirect/section/p...
Of course, you can replace 'redirect' with something that works for you.