Hi,

I've tried making a url redirect with a node reference. I have tried checking/unchecking all of the boxes for "force redirect" and "override path" but neither of them works as desired.

The closest I can come is to have the "override path" checked which gives me this:

http://example.com/?q=node/56&=node/44

Obviously, it is appending the desired url path instead of replacing.

I am using the token [node:field_proposed_change_url-nid] field_proposed_change_url is the name of my reference field which has test [nid:44] filled in from the prepopulate module.

If anyone can help, I'd appreciate it. I'm out of ideas.

Comments

fago’s picture

Component: Rules Core » Rules Engine
Status: Active » Postponed (maintainer needs more info)

that's strange. Does a "static redirect" like just "node/2" work right?

Ariesto’s picture

Good trouble-shooting question.

Yes, a static redirect works perfectly in a seperate rule that I use.

However, I cloned the problematic rule and changed the "dynamic" reference address to what it should be, "node/44". Instead of working properly it gave me:

</h3> ?q=node/64&=node/44

The only difference in these two rules is that the broken rule has a "Load a Referenced Node" action before the page redirect action. Inside the load a referenced node I have the "content containing the node reference" as "saved content".

The above suggests to me that something is ary in my Load a reference node settings. Below is the log code:



    *
          o 0 ms Content is going to be saved has been invoked.
          o 4 ms Included MODULE.rules.inc files.
          o 4 ms Executing the rule content_a_redirect_url on rule set Content is going to be saved
          o 4 ms Condition Saved content is feedback evaluated to FALSE.
          o 8 ms Executing the rule static_redirect_test on rule set Content is going to be saved
          o 8 ms Condition Created content is content_A or Content_B evaluated to TRUE.
          o 8 ms Action execution: Load a referenced node
          o 8 ms Successfully added the new variable referenced content
          o 999999120.007 ms Action execution: Page redirect
          o 999999120.007 ms Evaluation of Content is going to be saved has been finished.
    * Content_B test if static redirect works has been created.

Ariesto’s picture

The related group support question is here:
http://groups.drupal.org/node/18982

It outlines the results of a bunch of tests that I ran with the various checkboxes.

fago’s picture

Did you test both rules on the same event? Please try a new rule with a static destination target for the same event.

Ariesto’s picture

Status: Postponed (maintainer needs more info) » Fixed

Mystery Solved. Re-creating the rule showed where I was going astray. My broken rules were using "?=node/[referenced_node:nid]". The difference was that the "?=" was unnecessary. I guess drupal took the "?=" operator as an indication that you wanted to load both the normal address and the override one, resulting in the "&=" append.

I suggest that you either add a simple "if statement" to the rules code that checks for "?=" in the redirect address box, or at the very least make a note on the redirect page that the web address should NOT include "?=" even if clean urls are not enabled.

I will write up a doc on how to make redirects later today.

Thanks for the trouble-shooting support.

Ariesto’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.