Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Redirect Loop

Redirect Loop

I have created a simple rule that assigns a template when a user from a certain user group (Registered) is logged in.  It also removes some menus.  Everything works great except for when I try to do a redirect to a certain page and get the following error in my browser: 

This webpage has a redirect loop
The webpage at http://www.....com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Here are some suggestions:
Reload this webpage later.
Learn more about this problem.
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

I tried to look at this issue in debug mode and what I get is the following:

CHAMELEON DEBUG ON
Current date and time: "2012-08-08 13:44:44pm" in timezone "America/New_York"
Processing rule id 4 ("Registered")
- Groups: User is not logged in so cannot be a member of a selected group - failing
Started FAIL action for rule id 4
Finished FAIL action: default template style not changed
Finished all rules
Final template style unchanged
CHAMELEON DEBUG ON
Current date and time: "2012-08-08 13:44:44pm" in timezone "America/New_York"
Processing rule id 4 ("Registered")
- Groups: User is logged in and a member of a selected group - succeeding
Started SUCCEED action for rule id 4
* Setting default menu item to 380
- Removing menu item 267
- Removing menu item 110
- Removing menu item 111
- Removing menu item 126
- Removing menu item 127
- Removing menu item 151
- Removing menu item 152
- Removing menu item 153
- Removing menu item 279
- Removing menu item 268
- Removing menu item 320
- Removing menu item 328
- Removing menu item 329
- Removing menu item 330
- Removing menu item 331
- Removing menu item 267
- Removing menu item 110
- Removing menu item 111
- Removing menu item 126
- Removing menu item 127
- Removing menu item 151
- Removing menu item 152
- Removing menu item 153
- Removing menu item 279
- Removing menu item 268
- Removing menu item 320
- Removing menu item 328
- Removing menu item 329
- Removing menu item 330
- Removing menu item 331
- Removing menu item 243
- Removing menu item 236
- Removing menu item 215
- Removing menu item 213
- Removing menu item 216
- Removing menu item 243
- Removing menu item 236
- Removing menu item 215
- Removing menu item 213
- Removing menu item 216
- Removing menu item 341
- Removing menu item 341
- Removing menu item 295
- Removing menu item 296
- Removing menu item 318
- Removing menu item 298
- Removing menu item 269
- Removing menu item 297
- Removing menu item 295
- Removing menu item 296
- Removing menu item 318
- Removing menu item 298
- Removing menu item 269
- Removing menu item 297
- Removing menu item 313
- Removing menu item 317
- Removing menu item 314
- Removing menu item 313
- Removing menu item 317
- Removing menu item 314
- Removing menu item 131
- Removing menu item 225
- Removing menu item 240
- Removing menu item 130
- Removing menu item 131
- Removing menu item 225
- Removing menu item 240
- Removing menu item 130
- Removing menu item 141
- Removing menu item 142
- Removing menu item 155
- Removing menu item 143
- Removing menu item 144
- Removing menu item 141
- Removing menu item 142
- Removing menu item 155
- Removing menu item 143
- Removing menu item 144
- Removing menu item 281
- Removing menu item 281
- Removing menu item 101
- Removing menu item 101
- Removing menu item 146
- Removing menu item 146
- Removing menu item 112
- Removing menu item 113
- Removing menu item 308
- Removing menu item 309
- Removing menu item 118
- Removing menu item 310
- Removing menu item 303
- Removing menu item 119
- Removing menu item 154
- Removing menu item 232
- Removing menu item 312
- Removing menu item 306
- Removing menu item 114
- Removing menu item 278
- Removing menu item 270
- Removing menu item 112
- Removing menu item 113
- Removing menu item 308
- Removing menu item 309
- Removing menu item 118
- Removing menu item 310
- Removing menu item 303
- Removing menu item 119
- Removing menu item 154
- Removing menu item 232
- Removing menu item 312
- Removing menu item 306
- Removing menu item 114
- Removing menu item 278
- Removing menu item 270
* Redirecting to /

Not sure what the last line means.  I tried directing to a page using the dropdown menu and by entering an url, in both instances I get the error.

Please Help, Thank you.

Edited By: CMCM
08-Aug-12 19:16:43
CMCM
Guest
useravatar
Offline
Administrator has disabled public posting

Re: Redirect Loop

Hi CMCM,

The issue is probably that your rule detects logged-in users, AND does a redirect to a certain page. So what happens when it gets to that page? It seems that the same rule is triggered again, sending the person back to the same page again, in an infinite loop.

What behaviour would you prefer?
A: should the user get sent to that new page just once per session?
B: or do you want logged-in users to be restricted to ONLY that page?

If (A) then you can set up the 3 rules like this:
Rule 1: detect if user is logged in. If so, remove menu items and set template if required. Continue to next rule.
Rule 2: detect if Session Variable A is set. If so (in the succeed action), exit rule processions (i.e. abort processing)
Rule 3: detect if user is logged in. If so, "set session variable A" and redirect to the special page.

This way, the redirect only happens on the first page that the user looks at after logging in. After that, because the session variable is set, the redirect won't happen again.

For scenario (B) all you need to do is put in a check in the same rule you have already. Check that the user is NOT on the menu item that you are sending them to. So the rule won't trigger if they are already on that page.

Does that help?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Redirect Loop

I needed option A, I followed all your steps and it worked like a charm.  Thanks a lot for the great support.

Cheers
Sima

CMCM
Guest
useravatar
Offline
Administrator has disabled public posting

Re: Redirect Loop

did you mean to write something?

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Redirect Loop

Hello yes, sorry I initially did but then I thought it would be better to create a new topic because this topic initially was about the loop.  I posted my question here; http://www.metamodpro.com/forums/topic?id=1092  Thanks!

CMCM
Guest
useravatar
Offline
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10093
Newest User:
lamanaudio
Members Online:
0
Guests Online:
159

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked