I'm currently using sub-domains to segment clients to their own websites - this is only for appearance to show the client name in the URL. However, there is no need to use Subdomains. Instead, I'd like to have 1 website and rewrite the url so they each client's name appears like this in the URL like this: https://test.com/CLIENT_NAME/index.php
When the client first visits https://test.com/CLIENT_NAME/ if the session variable "CLIENT_NAME" !isset, I'd like to route them to test.com/index.php?id=CLIENT_NAME (but keep the URL showing as https://test.com/CLIENT_NAME/) so I can use the $_GET variable from "id" to get their data from the database and set the session variables.
Once logged in and the session variable of CLIENT_NAME is set, I'd just like to rewrite each URL to have /CLIENT_NAME/ after the base domain, but effectly the site will all pages as though it's just the base domain (without /CLIENT_NAME/).
For example once logged in: the URL will appear as test.com/CLIENT_NAME/page_1 but the server will access the file stored in the root public_html folder that would usually be accessed by visiting test.com/page_1.php.
At the same time, it would be great to remove ".php" from the end of each webpage (like in the above example).
Thanks for your assistance!
I've tried all sorts of other examples found on here, but it seems everyone uses a fixed parameter for the RewriteBase, instead of checking the session variables to see if something is set there and then using that value as the RewriteBase if it is, or redirecting the user to a GET request (with the url masked) to set the session variables.