I only learn to program in PHP. When I just turn on the main page (for example, site.ru), then it writes that this is the main one, and if you go to site.ru / index or site.ru / photo, then you simply get an error 404 .. I follow the example of a video tutorial, there everything in the guy works.
<?php header("Content-Type: text/html; charset=utf-8"); if ($_SERVER['REQUEST_URI'] == '/') { $Page = 'index'; $Module = 'index'; } else { $URL_Path = parse_url($_SERVER['REQUEST_URI'], 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') echo 'Главная'; else if ($Page == 'photo') echo 'photo'; ?> Htaccess file
RewriteEngine on RewriteBase / Options All -Indexes RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^resource/(.*)$ resource/$1 [L] RewriteRule ^.*$ [NC,L] RewriteRule ^.*$ index.php [NC,L]