infinit redirection loop with lightbox2 module I have a redirection with drupal_goto() function like that :

drupal_goto($url, array('fragment' =&gt;  'lightbox='.  $lb_path, 'alias' =&gt; 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 &amp;&amp; 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' =&gt;  'lightbox='.  $lb_path, 'alias' =&gt; 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...

http://www...com/node/5/?lightbox=yes#lightbox=&lt;whatever&gt;