RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/?$ index.php\?p=$1&action=$2
RewriteRule ^([a-zA-Z]+)/?$ index.php\?p=$1
for each ([a-zA-Z]+) it adds another number to the "results".. $1, $2, $3, etc. So you can add as many rewrites as you want... for example, this is one of my mod rewrites...
#WMS LIVE EDITOR
RewriteRule ^WMS/templateeditor/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ WMS/templateeditor.php\?p1=$1&p2=$2&p3=$3&p4=$4
RewriteRule ^WMS/templateeditor/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ WMS/templateeditor.php\?p1=$1&p2=$2&p3=$3
RewriteRule ^WMS/templateeditor/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ WMS/templateeditor.php\?p1=$1&p2=$2
RewriteRule ^WMS/templateeditor/([a-zA-Z0-9]+)/?$ WMS/templateeditor.php\?p1=$1
RewriteRule ^WMS/templateeditor/?$ WMS/templateeditor.php
on the php page, just add $_GET['action'];
and then set up your php to where if an action is set for the page, go to that action (in this case, settings).
I just used "action" as an example...it can be whatever you want it to be.
EDIT
RewriteEngine On
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/?$ index.php\?p=$1&$2
RewriteRule ^([a-zA-Z]+)/?$ index.php\?p=$1
my php code to test results
$p = 'home';
if(isset($_GET['p'])) {
$p = $_GET['p'];
echo 'p:'. $p;
}
echo ' ';
if(isset($_GET['settings'])) {
echo 'yes';
}
I went to domain.com/profile/settings and it echoed the following: p:profile yes
fixing includes
if(file_exists('rootDir.php')) { include_once ('rootDir.php'); }
if(file_exists('../rootDir.php')) { include_once ('../rootDir.php'); }
if(file_exists('../../rootDir.php')) { include_once ('../../rootDir.php'); }
if(file_exists('../../../rootDir.php')) { include_once ('../../../rootDir.php'); }
if(file_exists('../../../../rootDir.php')) { include_once ('../../../../rootDir.php'); }
if(file_exists('../../../../../rootDir.php')) { include_once ('../../../../../rootDir.php'); }
if(file_exists('../../../../../../rootDir.php')) { include_once ('../../../../../../rootDir.php'); }
This will help ignore the "fake folders" in the url
// ---------------------------------------- http() ---- determine if http/https
if (!function_exists('http')) {
function http() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == 'on') {$pageURL .= 's';}
$pageURL .= '://';
return $pageURL;
}
}
this is a php function that will identify whether your website is using http:// or https:// for the absolute paths
this is the function to get your website url for absolute paths
// ---------------------------------------- parse URL ---- split URL into parts
$websiteurl = http() . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI];
$website = parse_url($websiteurl);
$websitedomain = $website['host'];
if (strpos($websiteurl, '~') !== FALSE) {
$subweb = explode('/', $websitedomain . $_SERVER[REQUEST_URI]);
$websitedomain = $subweb[0] .'/'. $subweb[1];
}
example of how to add the code to your site
<link rel="stylesheet" type="text/css" href="<?php echo http() . $websitedomain .'/WMS/css/style.css'; ?>"/>