Hello. In .htaccess I have a rule:

RewriteRule ^ category /(.+)$ modules / category.php? Id = $ 1

Thanks to him, I get links like / category / 5 , where 5 is the id of the section I need from the database, I then get it from $_GET['id'] and I select it from the database.

The question is, how can I make links so that they look like / gorod / name , where gorod and name would be $ _GET values, that is, if without NC, then this link is modules/category.php?id=gorod&pod=name

I would be grateful for any useful information.

    1 answer 1

     RewriteRule ^(.+?)/(.+)$ modules/category.php?id=$1&pod=$2 
    • if I add this rule, all the others stop working (( - iKey
    • for example, it does not work anymore RewriteRule ^sign-up modules/reg.php [L,QSA] - answers not found - iKey
    • that is, it turns out all these links already lead to modules / category.php - iKey
    • @AntonShchyrov, gorod/name/and/noname/or/second/city/ also perfectly passes. - Visman
    • @ Denis Logical. And how are you going to distinguish the sign-up action from the city sign-up? Try this rule last. - Anton Shchyrov