Conversion of "query" an HTML form using .htaccess

1

I need to do a "query" conversion of an HTML form that should pass information to do a search in the database. I think it could be something like a kind of "friendly url", the simplest.

Basically it is, with this string passed by the form "? category = html & year = 2017 " to something like " / category / html " or " / year / 2017 ".

I know that you can do this with " .htaccess ", but I do not know how to do it.

Thank you if anyone can help.

    
asked by anonymous 12.10.2017 / 21:48

1 answer

0

For archiving purposes.

According to the article How To Rewrite URLs with mod_rewrite for Apache on Debian 8 , you can make this change in the URL through Apache's mod_rewrite .

The resolution in the .htaccess file would be the addition of this rule:

RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?category=$1&year=$2 [QSA]
    
14.10.2017 / 18:45