Create facebook style profile link

Asked

Viewed 140 times

0

Hello, I would like to know how to appear in the link of the client profiles of my project facebook link style (facebook.com/name_do_profile). Because I can’t put it without getting (site.com/profile.php?per=filename), ("?per=" being the variable of the profiles' name), I would like to do a scheme that would take this "profile.php? per=" for direct. Thank you!

1 answer

1

To do such a URL, you can use a project pattern called Front Controller, where all requests from your site will be managed by index php.

Example of what Urls look like with front-controller:

seusite.com/categorias
seusite.com/categoria/1
seusite.com/categoria/create

Understanding the concept and applying it to your project would look like this. When a request hits your index.php (example: seusite.com/Nomedoperfil ) your index will search your database for that username. If it exists it brings the view with user information.

It is quite simple to set up a Front Controller in a pure PHP project, but an alternative is to work with a PHP framework that already has in its core this project standard and many others that facilitate the development of applications, always following the best practices. I’ll leave a few links in case you’re interested.

Hugs !

Browser other questions tagged

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