Jump to content

404 not working for unicode URL


Erbenos
 Share

Recommended Posts

Hello,

I encountered interesting behaviour yesterday.

I have custom module, which serves as 404 redirect which works like this: 

$this->addHookAfter("ProcessPageView::pageNotFound", $this, "hook404Page");

And in hook404Page function I return 404 page.

The problem is while this does work for:

http://testsite.dev/nonpage

It doesn't work for non standard URL like these:

http://testsite.dev/něnpage

Any idea why? Thanks.

Edited by Erbenos
English is hard
Link to comment
Share on other sites

7 hours ago, Erbenos said:

Thank you, but that didn't fix it for me. I chanched htaccess, restarted Apache and nothing changed.

Just to confirm did you uncomment this rule?

RewriteCond %{REQUEST_URI} "^/~?[-_./a-zA-Z0-9æåäßöüđжхцчшщюяàáâèéëêěìíïîõòóôøùúûůñçčćďĺľńňŕřšťýžабвгдеёзийклмнопрстуфыэęąśłżź]*$"

Also, you don't need to restart Apache when changing htaccess files; you only need to restart if you have changed a configuration file, such as httpd.conf or a virtual host file.

  • Like 1
Link to comment
Share on other sites

Whoa... this is kind of funny. There is setting specifically for what I want just below:

 

# -----------------------------------------------------------------------------------------------
  # 14. OPTIONAL: Send URLs with non-ASCII name-format characters to 404 page (optimization)
  # -----------------------------------------------------------------------------------------------

  RewriteCond %{REQUEST_URI} "[^-_.a-zA-Z0-9/~]"
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?it=/http404/ [L,QSA]

One may wonder how does he have utf8 page names and correct 404 redirects but oh well, this is just what i needed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...