Use user-friendly URL without folder navigation

Asked

Viewed 130 times

1

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

How do I make this identification, bearing in mind that there will be no particular folder for individual client navigation. I already have the system ready, so the ideal solution would not be to mess with its structure

1 answer

0

I must assume you’re using $_GET, then just insert this into 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, as an example:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.