Well, you could still do it much the same way. Create one template file (or a general header and footer) and based upon the users query, you can define which php file to use. Something like:
index.php
<?php
$page = 'management'; // The default page to include if none is given
if(isset($_GET['page']))
$page = $_GET['page'];
include($_SERVER['DOCUMENT_ROOT'].'/inc/header.php');
include($_SERVER['DOCUMENT_ROOT'].'/'.$page.'.php');
include($_SERVER['DOCUMENT_ROOT'].'/inc/footer.php');
Since you say you want "/main#<whatever>" to be mapped to other links, you could use an associative array:
<?php
$pages = array(
'home' => 'index.php',
'personal' => 'personalFRM.php',
'professional' => 'professionalFRM.php',
// etc...
);
$page = 'home'; // Default page if none specified
// Only change the page to the one request IF it's a known page (keep people from trying
// to include malicious code on their own
if(isset($_GET['page']) && array_key_exists(strtolower($_GET['page']), $pages))
$page = strtolower($_GET['page']);
include($_SERVER['DOCUMENT_ROOT'].'/inc/header.php');
// Include the page from the array based upon the page requested
include($_SERVER['DOCUMENT_ROOT'].'/'.$pages[$page].'.php');
include($_SERVER['DOCUMENT_ROOT'].'/inc/footer.php');
Now those urls would be somethin like:
www.site.com/?page=Personal
www.site.com/?page=Professional
If you wanted urls like:
www.site.com/Personal
www.site.com/Professional
You'd need a .htaccess file to route all requests to your index.php file. Then in your index.php you'd need to manually look at the $SERVER['REQUEST_URI'] and explode on the "/" to get the options you want. This would take some testing to tweak it to just your purpose, but wouldn't take long at all:
First:
<?php
echo $_SERVER['REQUEST_URI'];
exit;
Just to see what the value is, and to make sure it's what you expect.
Then:
<?php
$parts = explode('/', $_SERVER['REQUEST_URI']);
print_r($parts);
exit;
To see which part(s) you need to use to form the url
Finally:
<?php
$page = 'home'; // Default page if none specified
$parts = explode('/', $_SERVER['REQUEST_URI']);
if(!empty($parts[1]) && array_key_exists(strtolower($parts[1]), $pages))
$page = strtolower($parts[1]);
include($_SERVER['DOCUMENT_ROOT'].'/inc/header.php');
// Include the page from the array based upon the page requested
include($_SERVER['DOCUMENT_ROOT'].'/'.$pages[$page].'.php');
include($_SERVER['DOCUMENT_ROOT'].'/inc/footer.php');
Your .htaccess file would look something like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?url=$1 [QSA,L]
</IfModule>
What that says is that if the requested url isn't a valid file or directory, then send it to index.php, putting the requested path as the $GET index "url". So instead of using $SERVER['REQUEST_URI'] above, we could use $_GET['url'] instead. Either way works, both do the same thing.
The other way to do it is with AJAX 😉 But that's something you can read up on at any time and figure out how to do.