Hello,
I am trying to write a PHP or Drupal code in Block. If the session is equal to IN or US then it should be redirected to the taxonomy term URL.
PHP - I tried to redirect using header(Location: ""). It is not working for internal URL(internal Website URL). For Example : listing/taxonomy/term/22 . However, I can redirect it to google.com .
Java Script - I have tried to redirect it using Java Script. I am able to redirect. But the page is loading continuously. It has not loaded completely even after 10 minutes.
Once the page is redirected, if I click on any other link say menu link it is still going to the listing/taxonomy/term/22 link or not allowing me to select different link after redirecting.
I want to redirect to listing/taxonomy/term/22 page, when the home page is selected or accessed and once it is redirected I should be able to select other pages(internal nodes by selecting buttons say menu).
To Sum up, I need a code, which will help me to:
1. Redirect to the listing/taxonomy/term/22 internal node page.
2. Once it is redirected, I should be able to choose any other link by clicking on them.
Please Help.
Regards,
Prasad
Comments
Have you tried with
Have you tried with drupal_goto()?
Assuming you want to redirect to listing/taxonomy/term/22 page while accessing home page (front page, in terms of Drupal), you can do following:
<?php// Add other conditions here, like session is IN or US.
if (drupal_is_front_page()) {
// This will redirect to 'listing/taxonomy/term/22', whenever front page is accessed,
// and your other conditions are true.
drupal_goto('listing/taxonomy/term/22');
}
?>
Hope this will help you.
-- tanmay
Redirect
Hello Tanmay,
Great...it worked. I was using drupal_goto in a different way. I didn't knew about drupal_is_front_page() function.
Thank you very much * 1000 times :)
Prasad