Rewriterule does not work with a specific word

Asked

Viewed 141 times

0

It just doesn’t work for "event", but if I change to "event" it works, e.g.:

Doesn’t work

RewriteRule ^evento/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ evento.php?log=$1&id=$2

Works

RewriteRule ^evenTo/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ evento.php?log=$1&id=$2

Full code of . htaccess

RewriteRule ^busca/([a-z,0-9,A-Z,_-]+)/([a-z,0-9,A-Z,_-]+)?$ buscador.php?log=$1&id=$2
RewriteRule ^busca/([a-z,0-9,A-Z,_-]+)/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ buscador.php?log=$1&id=$2&p=$3
RewriteRule ^local/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ interna.php?log=$1&id=$2
RewriteRule ^([a-z,0-9,A-Z,_-]+)?$ index.php?cid=$1
RewriteRule ^noticia/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ noticia.php?log=$1&id=$2
RewriteRule ^evento/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ evento.php?log=$1&id=$2
RewriteRule ^perfil/([0-9]+)?$ perfil.php?id=$1
RewriteRule ^cupom/([0-9]+)?$ cupom.php?id=$1
  • 3

    "works" and "does not work" is not information that helps a lot. It would be important to give a read on [Ask] and then [Edit] the question to make it more complete, with a better explanation of what happens. And the time you have a little time, I would suggest reading the [tour] and [help].

  • And you have some other rule for evento that’s breaking that one? Or do you have the links pointing to evenTo and you didn’t realize?

1 answer

0

There is no need for those commas, and your problem is the order of the statements. Try this way:

RewriteRule ^busca/([a-z0-9A-Z_-]+)/([a-z0-9A-Z_-]+)?$ buscador.php?log=$1&id=$2
RewriteRule ^busca/([a-z0-9A-Z_-]+)/([a-z0-9A-Z_-]+)/([0-9]+)?$ buscador.php?log=$1&id=$2&p=$3
RewriteRule ^local/([a-z0-9A-Z_-]+)/([0-9]+)?$ interna.php?log=$1&id=$2
RewriteRule ^noticia/([a-z0-9A-Z_-]+)/([0-9]+)?$ noticia.php?log=$1&id=$2
RewriteRule ^evento/([a-z0-9A-Z_-]+)/([0-9]+)?$ evento.php?log=$1&id=$2
RewriteRule ^perfil/([0-9]+)?$ perfil.php?id=$1
RewriteRule ^cupom/([0-9]+)?$ cupom.php?id=$1
RewriteRule ^([a-z0-9A-Z_-]+)?$ index.php?cid=$1

put index.php last, so apache tests all other rules before entering it, got it?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.