These conditions work?

1. "URL alias exists"
"Specify the URL alias to check for. For example," about "for an about page".

I create page "about".

The rule should work only for page "about" or everywhere (if there is a page "about")? Now the condition is carried out always (if there is a page "about"). And should be?

2. "Path has URL alias"
"Specifies the existing path you wish to check for. For example: node/28, forum/1, taxonomy/term/1+2".

I specify node/3, but the condition does not work: "The condition path_has_alias evaluated to FALSE".

P.S. I apologise for bad English.

Comments

klausi’s picture

Category: bug » support
denny84’s picture

Version: 7.x-2.x-dev » 7.x-2.0-rc2

Well shocking. Almost one year and this problem still persists. Confirmed "Path has URL alias" does not work.

denny84’s picture

Version: 7.x-2.0-rc2 » 7.x-2.0
pmichelazzo’s picture

I'm sad to hear that.

Any suggestion to check a path and make some change on the node?

pmichelazzo’s picture

I found a way to do that using "Text Comparison" condition.

This is not the right way but, almost one year waiting, can be a trick.

Yuri’s picture

Still not working...or its a feature i don't understand..

mitchell’s picture

Status: Active » Fixed

This functionality exists in 7.x a bit differently than in 6.x. There is the "path has alias" condition, which will work if you are using the path module. And, as pmichelazzo pointed out, using text comparison with [site:current-page:path] will also work. You'll need to learn how to use the "text comparison" condition to have success with this.

Status: Fixed » Closed (fixed)

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

ahillio’s picture

I'd love some clarification on this...

I wanted to use the condition "path has url alias" but I might making incorrect assumption about it. Here's what I need:

  • when a user logs in from the login page the rule should be executed and the person should be redirected to specific url
  • but when they login via one-time login link the redirect rule should not be executed (because then they can't reset their password).

I assumed I could set a condition of path has url [site:login-url] so that this rule would only work when a user logged in from that url. But when user logs in from a different url, the one-time login url for password reset, the redirect still happens.

Then I tried to set a negated condition of path has url [account:one-time-login-url]. But the rule's action is still performed - when users log in from the one-time login url they're are still redirected instead of being brought to their account page where they can reset their password.

Am I misunderstanding how this condition works?

If I'm trying to cause an action when a user logs in from the regular user/login url but not when a user logs in from the user/reset/id.... url, is "Path has URL alias" what I want to use?

mitchell’s picture

Title: Conditions "URL alias exists" and "Path has URL alias" » How to do path detection
Component: Rules Engine » Documentation
Priority: Normal » Major
Status: Closed (fixed) » Fixed

The confusion here stems from two separate, but intermingled, concepts of Rules' Path module integration versus a more general topic.

1) The 'Textual Comparison' condition is the right way to do what everyone is asking (so far called "checking a path"). It doesn't seem like it is because of the name of the condition is confusing and it needs more documentation. This condition is actually the right way to do a lot of things even when you'd expect there to be a specific event or condition that fits a particular situation. Even when you might expect there to be a specific trigger/event, Rules works by generalizing all of these with events like "Content is viewed", "Drupal is initializing" (for non-entities), and other specific implementations like Rules Bonus Packs's Page Manager integration "Create a Rules event for this variant".

2) "Path" is a loaded term. In general, the part of a url that follows the domain can be called a path, but in Drupal, the url for an object (don't think path here) can also have an entry in the database for an alias that is called a 'path'. This is a unique setup in Drupal compared to other web frameworks, though Drupal does have a comparable hook_url_inbound_alter() function. The Path module (usually with Pathauto) is the most popular method, but it is an additional layer on top of what you are most likely trying to check. [site:current-page:path] doesn't use the path module; it works at the layer of checking what url the user is loading. This will all likely be cleared up in D8, see #1553358: Figure out a new implementation for url aliases.

#1506298: Path Rules condition in Rules 7.x is also an issue where people have worked to address this, however I hope this information clears up the confusion.

Some other discussions about configuring this are:
#1336848: How to: match data with regex
#1202750: Event: How to trigger a rule when viewing a non-node page?
#1201260: Can't get Data Comparison 'site:current-page:path' to work

firestick13: I think this post should help answer your question as well as others, but if not, please open a separate support request to address your specific implementation.

Status: Fixed » Closed (fixed)

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

ntigh52’s picture

If I user pathauto module ,
may be this is the reason why I cant get the right resualt with the "Path has URL alias" and I need to use Text/data Comparison?
THnaks mitchell for all your answers.