Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Htaccess RewriteRule to accept special characters

My htaccess rewrite must handle these scenarios:

  • http://example.com/words/pantalón
  • http://example.com/words/pantal%C3%B3n
  • http://example.com/words/señor+señora

My current .htaccess configuration is:

RewriteRule ^dictionary/([\w\+]{2,50})$ /words.php?q=$1 [QSA,L]

It is not recognizing the special chars, e.g.: ñ, ó.

Any ideas? Thanks!

like image 956
Andres SK Avatar asked Oct 28 '25 21:10

Andres SK


1 Answers

Final solution

RewriteRule ^dictionary/([^/.]+)$ /words.php?q=$1 [QSA,L]
like image 103
Andres SK Avatar answered Oct 31 '25 13:10

Andres SK