Clean URL with simple PHP function

136 Views Asked by At

I don't how to go about it.

I have a single point of entry to my small site; presently the URL can only be accessed the old fashion way i.e

?action = anything

I need a PHP function on top on my index page to be able to things like:

 /register
 /{user}/edit
 /{product}

You get the idea.

This is my index code snippet:

switch($action)
{
    case '/':
        include('../app/views.php');
        break;

    case 'contact':
        include('../app/form.php');
        break;

    //auth start here
    case 'register':
        include('../app/register.php');
        break;
}

Thank you!

0

There are 0 best solutions below