Drupal throws 404 error after sharing a link on Facebook [Solved]

I had a strange error today. Lukily, a friend of mine warned me about it. I could hardly be aware of it without his help. (Thanks, Iosif!) So...

Why does Drupal 7 throws 404 error (Page not found)?

There could be plenty of reasons, but I guess the reason here is a bit stranger. All urls looked absolutely normal to me. I am using Pathauto with clean urls on. So why only SOME users get the page not found error? While looking at access logs, it seemed absolutely random to me. Of course, I had no 301 or 302 redirection component in case of errors.

I also didn't display a nice and friendly page for 404 errors (I thought I hadn't any). Pretty ignorant, huh? Visitors were discouraged and left away without even bothering to use the search box.

After a little bit of reasearch, I found a topic on a forum (I can't remember it, sorry) that gave me a hint. 

I had a multilanguage module installed I almost have forgotten of. In the module's settings page (admin/config/regional/language/configure) there were two checkboxes checked: User (Follow the user's language preference) and Browser (Determine the language from the browser's language settings).

With these settings on, the browsers who had a different default language other than English could have been redirected to a non existing page. That's because the website's interface is now in English only.

How to fix Drupal 7 Page not found error?

  • Disable multilanguage support if not needed.
  • Uncheck ALL support for automatic language detection in admin/config/regional/language/configure.
  • Change all content's default language to Language neutral (If you choose this you won't be able to edit your content later) English (or your default website language). If you have lots of content use VBO + Administration Views.
  • Lastly, monitor your 404 error pages and redirect them with Redirect module or other redirection module.

If I helped you with this article, leave some feedback please. I really enjoy reading comments!

Rate this article: 

Average: 5 (10 votes)


Samples of work done for me or my customers, for free or not, like websites, repairs, photography etc.
View all my recent work



I'm giving away some knowledge in my areas of expertise. Did you like something here? Share it please!
View all tutorials



Useful Linux commands or other code snippets I often use.
View my useful shortcuts



Few bookmarks I find useful. Do you want website here? Give me a good reason and I can help you.
View my favourite web resources

About me

Hi there! My name is Marius Cârneală.

About me?

Loving husband, dad of one two three, drone pilot, web designer and administrator, SEO specialist, IT support guy, electronic hobbyist and content writer. This list is open.