0

When you go to a website like linkedin, you can make your own linkedin.com/UserName folder.

How can when a user types website.com/UserName it go to website.com/profile.php?UserName with mod rewrite in .htaccess?

Sol
  • 255
  • 2
  • 9
  • 1
    It's probably done using a mod rewrite. If you want to avoid creating many folders, then that'd be an option. – Funk Forty Niner Oct 16 '16 at 15:51
  • I'll check into that. :) – Sol Oct 16 '16 at 15:52
  • 1
    It is done via Web server configuration - the queries are redirected to some controller (such as PHP script). There are so many ways to implement this, that the answer will not fit the format of SO. – Ruslan Osmanov Oct 16 '16 at 15:52
  • I'll confine it to mod rewrite then and edit this. I tried to be as specific as I could. – Sol Oct 16 '16 at 15:55
  • 1
    Here are a few links that may be of interest (based on linkedin's architecture and a few others) https://www.quora.com/What-is-LinkedIn-s-database-architecture-like --- http://blog.outsourcing-partners.com/2012/10/why-nosql-database-is-used-by-facebook-google-and-linkedin-applications/ --- http://vitalflux.com/data-handled-linkedin-com/ - Yet at this stage, the question would be rather broad. – Funk Forty Niner Oct 16 '16 at 16:05
  • 1
    Are you looking for https://moz.com/ugc/using-mod-rewrite-to-convert-dynamic-urls-to-seo-friendly-urls ? – Bhavesh G Oct 16 '16 at 16:05
  • Your suggestions really helped me understand it further. I see that it can be server/database driven, which is what would be easiest to handle. – Sol Oct 16 '16 at 16:13

1 Answers1

1

For smaller projects you can rely on this type of folder structure but in larger project you've to choose more elegant solution rather than creating thousands of messy folders.

There are already many routing solution available to choose from. You may have a look on https://github.com/dannyvankooten/PHP-Router this PHP Router class.

Khorshed Alam
  • 2,667
  • 22
  • 31