Convert "query" to an HTML form using . htaccess

Asked

Viewed 32 times

1

I need to make a conversion of a "query" of an HTML form that must pass information to do a database search. I think it might be something like a sort of "friendly url," of the simplest.

Basically it is, with this string passed through the formular "?Category=html&year=2017" for something like this "/Category/html" or "/year/2017".

I know it’s possible to do this with the ".htaccess", but I don’t know HOW do.

I’d appreciate it if someone could help.

1 answer

0


For the sake of filing.

According to Article How To Rewrite Urls with mod_rewrite for Apache on Debian 8, it is possible to make this change to the URL via mod_rewrite apache.

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

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

Browser other questions tagged

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