3
Good night,
I have a search that is working well, I’m only now having a problem when someone writes a word with accent or two words separated by space, breaks my url.
I’d like to know how I can resolve this situation?
Code
<form method="post" id="form" action="">
<div style="margin-left:150px;">
<div style="float:left; width:500px;"><input style="height: 38px;" id="valor_pesquisa" name="valor_pesquisa" type="text" placeholder="Restaurantes, bares, hotéis..." /></div>
<div style="float:left; margin-left:5px;"><input type="submit" value="Pesquisar" /></div>
</div>
</form>
<script>
$(function() {
$("#form").submit(function(e) {
if($('#valor_pesquisa').val() === ''){
$("#form").attr("action", "http://sabeonde.pt/locais/pesquisa/todos");
}else{
var valor_pesquisa = $("#valor_pesquisa").val();
$("#form").attr("action", "http://sabeonde.pt/locais/pesquisa/"+valor_pesquisa);
}
});
});
</script>
.htaccess
# Rota Pesquisa
RewriteRule ^locais/pesquisa/([a-zA-Z-0-9-_]+)$ index.php?controller=pesquisa&option=pesquisa&pesquisa=$1
Current
RewriteRule ^locais/pesquisa/([\p{L}\p{N}\s_-]+)$ index.php?controller=pesquisa&option=pesquisa&pesquisa=$1
From the Ternal server error if you take out the error you have in regex you already open the site if you have the space of the Ternal server error
– César Sousa
Works the spaces but accents not put up in the current as this
– César Sousa