Use friendly URL without folder navigation

1

I need to identify the user using a friendly url, for example: https://site.com.br/usuario/sistema.php

How can I make this identification, since there will not be any private folder for individual client browsing. I already have the system ready, so the ideal solution would not be to tinker with its structure.

    
asked by anonymous 26.12.2016 / 22:30

1 answer

0

I should assume you are using $_GET , so just enter this in your .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^usuario(|/)$ sistema.php
RewriteRule ^usuario/(.*)$ sistema.php?id=$1

Your urls will look like this:

https://site.com.br/usuario/1

    
26.12.2016 / 23:01