URL Routing Help: mysite.com/user. How can I achieve this? The docs does not explain this

Let’s say I have a site at www.mysite.com.

A user creates an account, redirects to my dashboard.
From the dashboard, he can create a username that allows his customers to access his page on my site by visiting his new URL - www.mysite.com/usercompany

I have built the logic for everything else and it works fine. Currently, I am using this: www.mysite.com/user?id=usercompany

I used routing to hide usercompany’s ID which does the filtering using ID as the argument.

Now, I’m wondering how I can lose the other aspects of /user?id= and just route them using mysite.com/usercompany

I will appreciate anyone who can give me the logic to build this. I am really confused because usercompany (I can do a database validation to make sure it does not exist), but how do I dynamically write a URL to my .htaccess file to generate the new user URL.

Community Page
Last updated: