Error while searching in form with Friendly URL

Asked

Viewed 76 times

0

I got the following .htaccess which so far has worked perfectly:

<IfModule mod_rewrite.c>

  RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule ^es/guarapari/empresas/([0-9]+)/([[a-z0-9-]+)/?$ empresas.php?id=$1&nome=$2&cidade=100 [NC]  

  RewriteRule ^es/guarapari/empresa/([0-9]+)/([[a-z0-9-]+)/?$ detalhes.php?txt=$1&nome=$2&cidade=100 [NC]

  RewriteRule ^es/guarapari\/?$ cidade.php?cidade=100 [L]

</IfModule>

However, I have the following form:

<form action="pesquisa.php" method="get" name="pesquisarguia">
        <input type="text" name="consultarguia" placeholder="Localizar empresa" required="required" class="frm-campos">
        <input class="inenviar" type="submit" value="Buscar">
        </form>

Every time I do a survey error 404 due I use Friendly URL.

What inclusion should I make in .htaccess for my research to work?

1 answer

1


Just as you have "Rewriterule" rules for other urls, create one (first of all) just for research.

RewriteRule ^es/pesquisa\/?$ pesquisa.php [L]

Then remember to update the action to the friendly url.

<form action="es/pesquisa" method="get" name="pesquisarguia">
  • Looks like your Urls start with es/ so I kept the format.

Browser other questions tagged

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