Answer the question
In order to leave comments, you need to log in
CNC url like VK?
Good evening!
VKontakte uses, as it seemed to me, quite convenient URLs: vk.com/feed
There is a code (I don’t know how correct it is, because I’m still a beginner):
index.php
if ( $_SERVER['REQUEST_URI'] == '/' )
$page = 'home';
else {
$page = substr($_SERVER['REQUEST_URI'], 1);
if ( !preg_match('/^[A-z0-9]{3,15}$/', $page) ) echo "404";;
}
if ($page == 'home') echo "home";
if else ($page == 'profile') echo "Страница пользователя";
if else ($page == 'news') echo "Новости";
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
Answer the question
In order to leave comments, you need to log in
.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<?php
$url = explode('/',strtolower(substr($_SERVER['REQUEST_URI'], 1)));
switch($url[0]) {
case '': {
include 'pages/main.php';
break;
}
case 'how_to_buy':{
include 'pages/how_to_buy.php';
break;
}
case 'payment_methods':{
include 'pages/payment_methods.php';
break;
}
case 'guarantees':{
include 'pages/guarantees.php';
break;
}
case 'payment':{
include 'pages/payment.php';
break;
}
case 'myorders':{
include 'pages/myorders.php';
break;
}
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question