I have a redirection with drupal_goto() function like that :

drupal_goto($url, array('fragment' =>  'lightbox='.  $lb_path, 'alias' => TRUE));

this link, after redirection, automatically open a lightbox, but the lightbox itselef still open another lightbox and so on ... (infinit redirection and opened lighboxes)

the lightbox is a content of node, and the idea is to redirect users from google search if it index a content of a lightbox. here my code in hook_node_view :

function MYMODULE_node_view($node, $view_mode, $langcode){
    if(strpos(request_uri(), "/lb/") !== FALSE && strpos(request_uri(), "lightbox") === FALSE){
         // the "/lb/" in path is only for lightbox content
         // my code here to get the right $url of the node containing the lightbox link.
         drupal_goto($url, array('fragment' =>  'lightbox='.  $lb_path, 'alias' => TRUE));

But unfortunately I get an infinit loop ! Maybe the if statement was my fault... Is there other alternative ? check for example if a lightbox is already open. But I don't think that would be possible in that php function! Any other help will be appreciated :)

Thanks in advance.


Fragments are not sent to the server as part of a GET request. That's why you aren't detecting them. You could try adding a query parameter, so the request would look like this...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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