Hi!

I try to setting in rules like below.

----------------------------------------------------------
Event : After saving new content of type Article
Condition : Content is published
Actions : Create or delete a content's URL alias(URL alias value is empty)
----------------------------------------------------------

Pattern for all Blog entry paths : content/[node:title].

1. I create content of Article type
2. I check published options in content
3. save

expect : not adjust URL alias(e.g /node/3)
result : delete a content's URL alias not worked (e.g /content/drupal)(if node title is drupal)

I don't speak english well, so I attach picture.

Thank you.

CommentFileSizeAuthor
그림2.png141.93 KBooooii12
그림1.png98.78 KBooooii12
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ooooii12 created an issue. See original summary.

ooooii12’s picture

Assigned: ooooii12 » Unassigned
Renee S’s picture

Confirmed.

TR’s picture

Status: Active » Closed (works as designed)

When content first gets created, it doesn't have a URL path alias. node/3 is NOT an alias! An alias is an alternative URL that will work. content/[node:title] IS an alias that you can use if you want your content to be accessed by either node/3 or content/[node:title]

But the important point here is that there is NO alias when the node gets created, UNLESS you have some other module which is automatically generating path aliases (Pathauto?). If that's the case, then you should modify that module's settings so that it doesn't generate an alias when you want the alias to be empty! There's no good way to ensure that other module modifies the node's alias before the Rule executes, and there's no good way to ensure the Rule executes after the alias is set. So the best way is to avoid the situation and make sure the alias is never generated to begin with. Alternatively, you could use the "After updating existing content" event - if Pathauto or some other module is adding a URL alias to your new node, then that node will have to be updated. It the node is updated, you would be sure that Pathauto has already done its job so there IS an alias to delete now.

I have tested the "Create or delete a content's URL alias" action using the "After updating existing content" event, and it always works. I have also tested creating a URL alias "After saving new content". Deleting a URL alias "After saving new content" doesn't have any effect because there is no URL alias for a new node, so there's nothing to delete.