Drupal Go to ends in infinite redirects
I am using drupal go to in page.tpl.php if anonymous user tries to access /node/edit ,so 开发者_开发问答that its redirected to /home page, this is how i am checking
global $user;
if( $user->uid !=1 ){
if($_REQUEST[q] =='node/edit'){
echo "IN IF";
drupal_goto('/', '', $fragment, 301);
}else if($_REQUEST[q] =='node/edit/'){
drupal_goto('/', '', $fragment, 301);
}
}
But i will get this error
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
There's a few things wrong with this. Mainly, if you don't want anonymous users to be able to edit nodes, it's much better to use the permissions system to do it, instead of doing it in the theme layer. This video should help you with that:
http://gotdrupal.com/videos/understanding-drupal-permissions
To debug what's going on, I'd recommend Firefox's live HTTP headers extension. If you use that, it can show you where the redirect is going to. From the looks of it, you've made an infinite redirect loop.
精彩评论