Merhaba, projemde local'de çalışırken /admin dediğim zaman panel login sayfasına beni otomatik olarak yönlendiriyor fakat aynı dosyaları sunucuya gönderdiğim zaman /admin yazdığım da bir yönlendirme yapmıyor aynı sayfayı yenileniyor sorun nerden kaynaklı olabilir ? Klasör yapısı olarak admin ve app olarak iki farklı klasörüm mevcut ana dizinde aşağıda ki index.php kodlarım mevcut
<?php
require __DIR__ . '/app/init.php';
$route = array_filter(explode('/', $_SERVER['REQUEST_URI']));
if (SUBFOLDER === true){
array_shift($route);
}
if (!route(0)){
$route[0] = 'index';
}
if (!file_exists(controller(route(0)))){
$route[0] = '404';
}
require controller(route(0));App klasörü altında ki kodum da ise aşağıda ki gibi
<?php
session_start();
ob_start();
function loadClasses($className)
{
require __DIR__ . '/classes/' . strtolower($className) . '.php';
}
spl_autoload_register('loadClasses');
$config = require __DIR__ . '/config.php';
try {
$db = new PDO('mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['name'], $config['db']['user'], $config['db']['pass']);
} catch (PDOException $e){
die($e->getMessage());
}
foreach (glob(__DIR__ . '/helper/*.php') as $helperFile){
require $helperFile;
}Örnek olarak da controller klasörümde ki admin dosyası kodlarım da aşağıda ki gibi
<?php
if(session('user_email')) {
if (!route(1)){
$route[1] = 'index';
}
if (!file_exists(admin_controller(route(1)))){
$route[1] = 'index';
}
} else {
if (!route(1)){
$route[1] = 'login';
}
if (!file_exists(admin_controller(route(1)))){
$route[1] = 'login';
}
}
// if (!route(1)){
// $route[1] = 'index';
// }
// if (!file_exists(admin_controller(route(1)))){
// $route[1] = 'index';
// }
require admin_controller(route(1));