php - htaccess error when dealing with non-english characters in url, but working without it -
if article title in url written in full english, displayed correctly. if title written in greek, 404 page. without using htaccess rewrite rule, displays page.
my question how can make work htaccess?
htaccess error when dealing rewriteengine on rewritecond %{request_filename} !-f rewriterule ^article/([a-za-z0-9]+)/?$ article.php?title=$1 [nc,qsa,l] rewriterule ^([^\.]+)$ $1.php [nc,l]
3 scenarios:
first (english chars):
title: hello url: example.com/article/hello opens page
second (greek chars):
title: γειά url: example.com/article/γειά requested url article/γειά.php not found on server.
third (without using htaccess):
/article.php?title=γειά opens page
[a-za-z0-9]
match english text , numbers.
change article rewrite rule to:
rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^article/([^/]+)/?$ index.php?title=$1 [nc,qsa,l]
[^/]+
match 1 , more of character till next /
matched or end of string reached matching non-english characters.
Comments
Post a Comment