How can I allow special characters in htaccess? I'm using:
RewriteRule ^Juegos/Xbox-One/([0-9]+)/([0-9a-zA-Z_-]+)/ single.php?ID=$1 [L]
However, letters like the ñ or accented words make the URL not work. I'm also having a problem with that sign: -
The URL example for this case is as follows: Juegos/Xbox-One/1189/Rocket-League-–-Crate-Unlock-Key-x5/
I tried to replace it in PHP using the following code:
function limpia_url ($juego) {
$titulo_limpio = preg_replace('~[\\/:*?"<>|]~', '', $juego);
$titulo_limpio = str_replace(str_split('\/:*?"<>|'), '', $titulo_limpio);
$titulo_limpio = str_replace("-","",$titulo_limpio); //aquí debería eliminarme el carácter, pero no lo hace
$titulo_limpio = str_replace(",","-",$titulo_limpio);
$titulo_limpio = str_replace("'","",$titulo_limpio);
$titulo_limpio = str_replace(" ","-",$titulo_limpio);
return $titulo_limpio;
}
The only thing that occurs to me is that since I can not remove it, allow it in htaccess. In the case of accents, it might be better to replace them with the corresponding vowel without an accent.