Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I personally would have the application perform all of the necessary routing logic instead of relying on .htaccess. This is how <em>I</em> would do it:</p> <p>I would start by using a pre-built router class/module/library. If you are coding in PHP, use something like <a href="http://alloyframework.org/manual/url-router/" rel="nofollow">Alloy Router</a>. If you are using a framework of some sort, routing might already be built in. </p> <p>Next step would be to make a "catch all" profile route that catches all routes that haven't previously been "caught". You might have a bunch of other routes such as "website.com/about", "website.com/contact", etc, which will get caught first and then the catch-all route will get all others.</p> <p>The catch-all route will route your application to a "profile" controller. This controller looks at the given route and checks to see if the "username" within the route matches a username in your database. If so, create the profile of that particular user. If not, provide a 404.</p> <p>You'll have to make sure all usernames are unique and they don't conflict with other routes (i.e. a user can't have the username "about" otherwise their url will be caught by the "about" route).</p> <p>Finally, within your application you will have to make all of your links go to the proper urls. If you have a "profile" button in a top navigation bar, you will want to make sure it actually goes to "website.com/username" where username is the actual username of the currently logged in user. All links to other user's profiles will be dynamically created to go to the correct url that includes their usernames.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload