Say I am rolling out a CMS. Each user gets their own page at domain.com/username/index.php. At the moment I'm considering having a new account create a folder at said location and make an index file like so:
<?php
$username=blahblah;
require("../indextemplate.php");
?>
Which would work fine. Everyone gets their own custom pages and such. What seems stupid to me is that I have to make identical folders and files for every unique user. Is there a way instead to catch people using a domain.com/username. And send them directly to indextemplate.php?
As I'm typing this I realized I might be able to use the 'that page does not exist' redirect that apache has in combination with $_SERVER["REQUEST_URI"] (not sure if the apache redirect will mess w/ the url) to go to the correct page.
I guess I'm asking then which approach is better (creating millions of folders/pages was the solution i found googling but it really seems worse). Is their a horrible downside to the second option? Or a third way perhaps.