Hi !
Thanks for making this module available in D8 ! I have an issue related to language, but maybe this is me poorly configuring my website. I will try to make my issue as clear as possible.

Problem/Motivation

Basically: "Page not found" keeps occuring when visiting my pages using the URL alias.

- I have a Drupal 8.1.1 website
- Only one language is configured (done from install) and available at: admin/config/regional/language It is French.
- I have only configure one pathauto motif: [node:title] on all content-types

Now how should I configure my content-type language ? to french, to site default language ? to non applicable ? It looks like I tried every configuration but keeps getting this "Page not found" issue.

Could someone eventually explain me more on how to configure it ?

CommentFileSizeAuthor
#19 alias_db.png173.33 KBrcodina
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dom. created an issue. See original summary.

sgurlt’s picture

Subscribing, I am having the same issue. Have you found a solution on this?

borisson_’s picture

We're having the same (or at least a very similar) issue. I'll try to explain what happens here.

1. installed drupal 8.1.7 with dutch as only language.
2. I created one pathauto pattern and that applies to the content type.
3. I create a new node, navigating to that node returns 404.
4. I go to /admin/config/search/path
5. I see that the url alias is configured - it has the correct node and a language: dutch.
6. I edit the alias and change the language to und.
7. I go back to the page and see 200 w/ content.

Expected behavior:
remove steps 4-5-6 ;)

I can try to write a test for this if that's useful?

Berdir’s picture

That's not really a bug. Creating an alias from the context of an entity, manually (without pathauto) or with pathauto always creates them in the language of the entity.

I'm happy to expose a setting on each pattern to configure if the alias should be created for a specific language (including und) or if it should respect the language of the entity. But that's IMHO a new feature because this is how pathauto always behaved.

borisson_’s picture

I've been trying to figure this out further, and it looks like the steps I added in #3 were not correct.

So, I'll try to add the steps again.
1. I created one pathauto pattern and that applies to the content type.
2. I create a new node, navigating to that node returns 404.
3. I go to /admin/config/search/path
4. I see that the url alias is configured - it has the correct node and a language: dutch.
5. I edit the alias and save the form without changing anything
7. I go back to the page and see 200 with the correct content.

I have page_cache and dynamic_page_cache enabled, but disabling both doesn't change the outcome. I think there need to be additional caches cleared on path_insert|update but I'm not sure.

Berdir’s picture

What is your interface/content language set-up? And what exactly is a 404? The alias? I assume node/ID works?

Are you sure you're accessing the page in the same language as the content? What happens if you create an alias manually?

We do not decide which alias is used, all we do is generate and and then Drupal should use or not use it depending on whether the language matches

borisson_’s picture

What is your interface/content language set-up?

There's only one language, dutch, both for interface and content

And what exactly is a 404? The alias? I assume node/ID works?

node/ID does work, the alias doesn't.

Are you sure you're accessing the page in the same language as the content?

I assume so, as there is only one language.

What happens if you create an alias manually?

If I add an alias trough admin/config/search/path with a new path, and I go to that path i see a 200 with the correct response.

We do not decide which alias is used, all we do is generate and and then Drupal should use or not use it depending on whether the language matches

From the time I had to look at this, I think there's additional cache tags that are invalidated when saving trough the path edit form. I don't have any idea if that's even possible.

I don't have a lot of extra time to look at this this week, there's a national holiday tomorrow, I might have some time to debug this further next week.

santilopez’s picture

Priority: Normal » Major

I reproduce the same problem of @borisson_ but we have the web only in Spanish. His workaround on #5 works for us too. Please, fix this ASAP!

burlap’s picture

I have the same issue (single language, not English), #5 seems to work for me (not reliably, sometimes I need to change alias language to none).

I thought this might be related to the site language setting of the user creating content (my users had it set to English), but I have no time to investigate it now. Setting it to the actual site language helped for some users, but I don't have enough evidence.

Berdir’s picture

Issue tags: +Needs tests

I'm still not sure why this would happen, we have plenty of sites in german or even multiple languages and aliases work for fine.

Can you reproduce the same if you manually create an alias?

It could be that something accesses the page already before the alias is stored. database cache backend?

If it would be a cache problem, then just clearing caches, wtihout resaving anything should fix it.

A failing test would definitely help.

santilopez’s picture

@Berdir

Can you reproduce the same if you manually create an alias?

The same URL works if I assign it to a node manually but it fails If it is created by pathauto.

It could be that something accesses the page already before the alias is stored. database cache backend?

I don't think so. Do you mean that could be a contrib module that breaks this?

If it would be a cache problem, then just clearing caches, wtihout resaving anything should fix it.

Clearing the cache doesn't work.

FrancescoP’s picture

My 2¢:

I have a small site with one content language: Italian. Content were automatically created with language: Italian, and pathauto created aliases assigned to Italian too (pathauto assign to the alias the same language of the content it is analyzing).

But my admin user is configured to use English as default, I lost hours trying to understand what wasn't working: when using the admin English user, the Italian aliases were not read (and some of the views also tried to search English content).

So this is what I did:
- for every Content Type => Language Settings => Not specified
- changed the language of every content di Not specified
- bulk erased all aliases
- bulk created all aliases

Now all aliases are assigned to Language = None, new content generate aliases with the same assumption, and everything seems to work again!

speratamente,
Francesco P.

Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

If cache clear doesn't help then it is not a cache issue.

Create an automated alias that doesn't work and a manual alias that works and compare them, there has to be a difference? What is the language?

burlap’s picture

Please check the admin/user language (and not content or alias language) settings. It seems that @FrancescoP has solved the issue the same way as I did.

rcodina’s picture

Create an automated alias that doesn't work and a manual alias that works and compare them, there has to be a difference? What is the language?

- On admin/config/regional/language we only have Spanish listed (so it's the default).
- On admin/config/regional/content-language we have Content Type "Taller" with Spanish selected as default language
- I have node/86 titled "Taller 2" with manual alias /talleres/taller-2 => It works
- I have node/139 titled "Taller nuevo siguiente" with auto alias /talleres/taller-nuevo-siguiente => It doesn't work (page not found)
- Both nodes are published
- if I access node/86 or node/139 directly it works
- My admin user has Spanish as default language

rcodina’s picture

Could this be related to this issue? #2661178: Error: Mismatched entity and/or field definitions

If I run drush entity-updates I see this:

The following updates are pending:

node entity type : 
  The Alias de URL field needs to be uninstalled.
taxonomy_term entity type : 
  The Alias de URL field needs to be uninstalled.
Do you wish to run all pending updates? (y/n):

But I don't want to do it because I'm afraid to break something. Should I do it?

It also could be related to this another one: #2601762: Mismatched entity and/or field definitions after upgrade from RC1 to RC2

Because my Drupal was initially 8.0.3 and was then updated so many times until 8.1.8.

rcodina’s picture

@Berdir Do you need more info to help us on this?

Berdir’s picture

Yes, your answer to #13 is not enough. I'm not asking about the behavior of the alias, but how exactly they are stored (path, language, ..). Compare the two rows in the UI or even in the database.

And no, that other issue is unrelated.

rcodina’s picture

FileSize
173.33 KB

@Berdir Here comes a database screenshot of alias. I hope this would help you. Surprisingly they seem both fine. Look at the two final rows.

dhansen’s picture

I'm seeing this same issue on my site. A few pages 404 on aliases generated by Pathauto. I've got English (default), Spanish, Traditional and Simplified Chinese enabled on the site.

Clearing all caches seems to solve the issue temporarily for me. I can edit the node, delete the URL alias, save, then edit the node again enabling the autogenerated URL alias and that works, but again this seems to be temporary. The entries do not seem different in the database when created, similar to @rcodina.

I'm happy to provide any information to diagnose this as the production version of this site is already live and I just don't have any explanation for this issue.

rcodina’s picture

@dhansen What versions are you using?

My setup:

Core => 8.1.8
Pathauto => 8.x-1.0-alpha3+16-dev
Token => 8.x-1.0-alpha2
Chaos tools => 8.x-3.0-alpha26

Berdir’s picture

Can you reproduce the same problem on a new installation, as minimalistic as possible? Does it also happen with alpha3 (has other bugs with translations I think but might show that this is a regression compared to that).

rcodina’s picture

@Berdir

Does it also happen with alpha3 (has other bugs with translations I think but might show that this is a regression compared to that).

I was using alpha3 when I found out the problem. Then I installed latest dev branch of Pathauto to try to solve the issue but the result was the same.

Can you reproduce the same problem on a new installation, as minimalistic as possible?

I will do it as soon as I can.

dhansen’s picture

@rcodina

Drupal Core 8.1.8
Pathauto 8.x-1.0-alpha3
Token 8.x-1.0-beta1

A big part of my issue is that I'm not able to reliably reproduce it. I worry though that my issue may be different because a cache clear at least temporarily seems to solve it.

rcodina’s picture

@dhansen Clearing the cache doesn't work for me. Maybe later I will try to update token module.

rcodina’s picture

@Berdir I've build a Drupal from scratch with minimal required modules and after 1 hour I'm unable to reproduce the error.

I just don't understand why on my other Drupal installation the error only happens on only one content type. It's kinda weird!

Berdir’s picture

Yeah, it definitely is. We have various sites in multiple languages, some have multiple languages and I've never seen a problem like this. Something must be different on your site.

Contact me through the contact form if you can somehow give me access to your project where it happens so I can try to debug there.

pdenooijer’s picture

I have the problem when running my behat test on ci. After lots of trying different ways to solve the problem, I found a workaround/solution. I had no pathauto pattern for the problematic node type, after creating it the problem disappeared.

For me the problematic node type is used for general pages, so I made the following pattern: '/[node:title]'.

Nor4a’s picture

Same problem
Drupal 8.2.0
Pathauto 8.x-1.0-beta

Path is generated correctly and it can be found in admin/config/search/path.
Some of the pages randomly stop working using alias. If you access them by /node/x they work fine.

When cleaning the cache or just editing the node event without saving - the url alias starts working again...
Probably some caching issue... very strange random bug... and it seams to happen only with some nodes - not all...

azinck’s picture

rcodina’s picture

rcodina’s picture

In case you have the same problem as me: The real problem I had was that in my pathauto rule I had a tab character at the end of the pattern. Removing it makes the problem disappear also in prior versions of Drupal core (<=8.2.x). To find out if your problem is similar, just update to 8.3.0-beta1 and see if URL are still failing. If not, check out the URL and see if there is an strange character there.

rcodina’s picture

Status: Postponed (maintainer needs more info) » Active

@Berdir Maybe the action to take here is to remove strange characters once user saves one pattern. What do you think? Could you try now to reproduce the problem?

Berdir’s picture

Yes, patches welcome to trim the pattern before saving.

Berdir’s picture

Title: "Page not found" depending on language settings » Special characters like tab or spaces in pattern can break alias generation