BUG: Hex encoded characters in URI and 404
-
Hello,
I have issues with the option removing /category/ directory from the URI.
If I request a category using this short syntax (without /category/), and it contains any hex encoded characters, and if the hex characters are upper case, WP does not find the page and returns 404.
Upper case will not work https://www.domain.jp/%E8%A3%BD%E5%93%81%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E8%B3%AA%E5%95%8F/%B9%E6%B3%95/
Lower case will work https://www.domain.jp/%e8%a3%bd%e5%93%81%e3%81%ab%e9%96%a2%e3%81%99%e3%82%8b%e8%b3%aa%e5%95%8f/%b9%e6%b3%95/
Upper/lower case in hex encoded characters must not make any difference.
WP keeps the pages in lowercase hexadecimal, probably SEO Ultimate matches using case sensitive compare.
Bug is present only for categories handled by SEO ultimate.
My current workaround is to convert hex encoded characters to lower case using this code
// make sure hexadecimal characters are in lower case, otherwise wordpress will give 404 $url2 = preg_replace_callback('/\%([ABCDEF0-9]{2})/', function($m) { return strtolower($m[0]);}, $requestUrl); $_SERVER['REQUEST_URI'] = $url2;
Fix must probably be pofined to convert only URI without the GET parameters part. Not sure about that.
Thanks for fixing it directly in SEO Ultimate
- The topic ‘BUG: Hex encoded characters in URI and 404’ is closed to new replies.