0

I'm trying to create friendly url for administrative page, i do it well with website separate pages but when it comes to put link on variable i can't get it. here's my code:

index.php:

    <?php include_once("menu/menu_adm.php");            

        $pag[1] = "user/profile.php";

        $pag[2] = "user/edit_user.php";

        if(!empty($_GET["link"])){
            $link = $_GET["link"];
            if(file_exists($pag[$link])){
                include $pag[$link];
            }else{
                include "home.php";
            }               
        }else{
            include "home.php";
        }

    ?>  

The actual url looks like this: "localhost/system/admin/index.php?link=1" I need to turn this into "localhost/system/admin/user/profile"

I'm not expert in .htaccess so if you can do a example it will be very helpful. thanks.

JS Santana
  • 119
  • 1
  • 2
  • 12
  • That's not a duplicate since he want's to include a file location using a variable. Not to rewrite the link. – hungrykoala Feb 15 '18 at 03:47
  • i don't think is the same thing but i need to change rewrite the link, The actual url looks like this: "localhost/system/admin/index.php?link=1" I need to turn into "localhost/system/admin/user/profile" – JS Santana Feb 15 '18 at 03:49
  • Maybe this can be helpful https://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php – Bits Please Feb 15 '18 at 04:33

0 Answers0