Through .htaccess you need to make it so that the address would be site.com/category/id $rowcat['name']

How to configure .htaccess so that the url is like site.ru/$rowcat['name']/$row['id']/ ?

    1 answer 1

    For the first time I see an array element in the value of a URL variable. :-) It is difficult for me to understand these constructions. Apparently, some mod_rewrite rules have already been applied.

    Maybe now file.php?id=1&cat=2 , for example? Or is file.php?id=1/2 ? But do you need it, as I understood at all site.ru/2/1/ or is it still site.ru/2/1 ?

    Teach how to turn such a simple question into such a difficult one ?! :-)

    upd

    Add lines to .htaccess

     RewriteEngine On RewriteRule ^([0-9]+)/([0-9]+)$ file.php?cat=$1&id=$2 RewriteRule ^([0-9]+)/([0-9]+)/$ file.php?cat=$1&id=$2 
    • :) Let the url be file.php? Id = 1 & cat = 2, the variable only id is used anyway. As for the last slash, it is necessary that both options work ... - rimlin
    • If only id is used, why then the category variable? For beauty? :) - Angelina_Jo
    • Yes, for beauty :) - rimlin