I want create to something like adf.ly script with Drupal. I am using shurly (developed by Jeff Robins) for URL shortening, and it works fine, but I want to display an advertising page for 10 seconds before redirecting to the final URL, which is not a feature provided by this module.

It has a hook called hook_shurly_redirect_before() which may help me, but I don't have enough knowledge to use it.

Can anyone explain how I should use this hook?

  • Shurly module does its job during the bootstrapping so most of the standard Drupal functionality is unavailable here. You will need to include necessary files manually, theme the page through a template file, and then add a mata refresh or something. I'm not quite sure how to do it well though.
    – AKS
    Commented Dec 16, 2012 at 15:16

1 Answer 1


With a quick glance at the shurly code, I'd think this should work:

function yourmodule_shurly_redirect_before(&$redirect) {
  $redirect->destination = 'path/to/advert?somevar='. $redirect->destination; 

And then you need to set up your advertisement page as path/to/advert and have it redirect to $_GET['somevar'] after the timeout.

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.