Hello. Please advise how best to adjust the beauty in the url and page 404 I have now in apache so
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/?$ index.php?p=$1 [L,QSA] And in index.php I check $ _GET ['p'] and issue the necessary page
switch ($_GET['p']) { case '/': require 'templates/main.php'; break; case 'uslugi': require 'templates/services_and_tariffs.php'; break; ... и т.д. ... default : header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); But, in that case, the apache directive will not work.
ErrorDocument 404 /templates/404.html If in index.php in default: add a title
header('Location: templates/404.html'); Everything seems to be working, but the headers are not sent as needed, when displaying page 404
мой_сайт/jklsldj - 302 404.html - 200 Tell me, is it possible to do so that when entering a non-existent page, the title 404 is given, but at the same time the page 404.html is shown or does my entire structure need to be changed? Anticipating the question why not to leave it as it is, I will answer this way - I do not know if this is correct. On the Internet, they write that for search engines it is better when there is no redirect, if the page does not exist, so I drove.