Answer the question
In order to leave comments, you need to log in
Single sign-on file problem, how to solve?
<?php
//установка кодировки
header("Content-Type: text/html; charset=utf-8");
//Обработка запросов
if ($_SERVER['REQUEST_URL'] == '/') {
$Page = 'index';
$Module = 'index';
} else {
$URL_Path = parse_url($_SERVER['REQUEST_URL'], PHP_URL_PATH);
$URL_Parts = explode('/', trim($URL_Path, ' /'));
$Page = array_shift($URL_Parts);
$Module = array_shift($URL_Parts);
if (!empty($Module)) {
$Param = array();
for ($i = 0; $i < count($URL_Parts); $i++){
$Param[$URL_Parts[$i]] = $URL_Parts[++$i];
}
}
}
//переадресация между страницами
if($Page=='index')include('page/index.php');
elseif($Page=='login')include('page/login.php');
elseif($Page=='register')include('page/register.php');
?>
RewriteBase /
Options All -Indexes
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^resource/(.*)$ resource/$l [L]
RewriteRule ^.*$ [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Answer the question
In order to leave comments, you need to log in
Why not mess around and try a simple framework like https://www.slimframework.com/docs/v3/objects/rout...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question