I'm not sure how it could work 'like rewrite' without rewrite. Maybe you misunderstood me
This is my .htaccess file, but I cannot use it, because it block access to 'static' and 'layouts' folders:
This is how I parse 'rewrite mod' in PHP:
- PAGE is of course page, it could be also one of params, but I wanted to make it look nicer when rewrite mod is off
- $_PARAMS is array with params from URI (rewrite on) or from special GET/POST key 'amp'
- in link and form generator you can use custom parameters, that are parameters with keys definied by you, I've added it to make AAC easier to use (add new scripts) for people that don't understand how to use params script, they can use classic $_REQUEST
All is definied in classes and scripts that parse it, so you don't have to understand how it work with/without rewrite mod. Just use classes Link and Form to generate forms and links
This is my .htaccess file, but I cannot use it, because it block access to 'static' and 'layouts' folders:
Code:
RewriteEngine on
RewriteRule ^ index.php [L]
PHP:
// DEFINE PARAMS AND PAGE
$_tmp_params = array();
if($configSite->getValue('useRewrite'))
{
$_uri_params = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'));
foreach($_uri_params as $_pi => $_uri_param)
{
if(isset($_uri_param) && in_array($_uri_param, $configSite->getValue('pagesEnabled')))
{
$page = $_uri_param;
unset($_uri_params[$_pi]);
break;
}
unset($_uri_params[$_pi]);
}
if(count($_uri_params) > 0)
foreach($uri_params as $_uri_param)
$_tmp_params[] = $_uri_param;
}
else
{
if(isset($_REQUEST['page']) && in_array($_REQUEST['page'], $configSite->getValue('pagesEnabled')))
$page = $_REQUEST['page'];
if(count($_REQUEST) > 0)
foreach($_REQUEST as $key => $_tmp_param)
if(substr($key, 0, 3) == 'amp')
$_tmp_params[(int) substr($key, 3, 2)] = $_tmp_param;
}
$WEB->setParams($_tmp_params);
if(!isset($page))
$page = $configSite->getValue('pageDefault');
$pathToPage = './pages/' . $page;
// limit number of folders to 10
for($_pi = 0; $_pi <= 10; $_pi++)
if(isset($_tmp_params[$_pi]) && Functions::isValidFolderName($_tmp_params[$_pi]) && file_exists($pathToPage . '/' . $_tmp_params[$_pi]))
{
$pathToPage .= '/' . $_tmp_params[$_pi];
unset($_tmp_params[$_pi]);
}
else
break;
$pathToPage .= '/';
$_PARAM = array();
foreach($_tmp_params as $_tmp_param)
$_PARAM[] = $_tmp_param;
define('TITLE', $configSite->getValue('serverName') . " - " . ucwords($page));
define('PATH_LAYOUT', './layouts/' . $configSite->getValue('layoutName') . '/');
define('PATH_PAGE', './pages/' . $page . '/');
define('PATH_SCRIPT', $pathToPage);
define('PAGE', $page);
// DEFINE PARAMS AND PAGE END
- $_PARAMS is array with params from URI (rewrite on) or from special GET/POST key 'amp'
- in link and form generator you can use custom parameters, that are parameters with keys definied by you, I've added it to make AAC easier to use (add new scripts) for people that don't understand how to use params script, they can use classic $_REQUEST
All is definied in classes and scripts that parse it, so you don't have to understand how it work with/without rewrite mod. Just use classes Link and Form to generate forms and links