Answer the question
In order to leave comments, you need to log in
How to decide that parameters are passed through htaccess?
Hello everyone, how to pass GET parameters to htaccess using switch case ?
There is such a routing.
/index.php
# Шапка
include('inc/head.php');
# Страницы
$url = explode('?', $_SERVER['REQUEST_URI'], 2);
switch($url[0]){
case '/' : require __DIR__ . '/pages/main.php';break; // Главная
case '/login' : require __DIR__ . '/pages/login.php';break; // Вход
case '/reg' : require __DIR__ . '/pages/reg.php';break; // Регистрация
case '/about' : require __DIR__ . '/pages/about.php';break; // О проекте
default: require __DIR__ . '/404.php';break; // 404
}
# Подвал
include('inc/foot.php');
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
Answer the question
In order to leave comments, you need to log in
Issue resolved!
We get a link like /link/edit/132
remove the extra
$link_add = mb_eregi_replace('[^0-9 ]', '', $uri[0]); // получаем число
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question