Rules UI: adding a condition base on URL

If you'd like to apply a rule only at certain URL paths, add this php condition:

$url = drupal_get_path_alias($_GET['q']);
$needle = array(
'search_pages',
// 'another-url',
);

foreach ($needle as $url_needle){
if (strstr($url, $url_needle)){
return TRUE;
}
}

return FALSE;
?>

UPDATE

Looks like this module may also be helpful:
Path Rules

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.