Answer the question
In order to leave comments, you need to log in
How to set up a 404 rewriterule response?
Good day to all.
I have a problem with a 404 server response.
The site was created on the basis of one ordered by a friend of mine.
There is a .htaccess file with the following content:
DefaultLanguage ru
AddDefaultCharset utf-8
php_value default_charset "utf-8"
php_value date.timezone "Europe/Moscow"
#AddType application/x-httpd-php .php .phar
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html .phtml .phar
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.phar))$ [NC]
#RewriteRule (themes\/default)([\d\w\-\/\:\.]*) ${themes/default.phar:$2} [L,QSA]
#RewriteRule ^/tmp/([^\.]+)\.(png|jpg|gif)$ /image.php?file=$1.$2 [NC,L]
RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.jpg|\.jpeg|\.png|\.ico|\.tif))$ [NC]
RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.css|\.js|\.eot|\.svg|\.ttf|\.woff|\.woff2|\.map))$ [NC]
RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.pdf|\.txt|\.html|\.xml))$ [NC]
#RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.phar|\.php))$ [NC]
RewriteCond %{REQUEST_URI} !^([\d\w\-\/\:\.]*(?:\.ogm|\.ogv|\.ogg|\.webm|\.mp4))$ [NC]
RewriteRule . index.php [L,QSA]
#RewriteRule ^(.*[^/])$ /$1/ [L,R]
AddType video/ogg .ogm
AddType video/ogg .ogv
AddType video/ogg .ogg
AddType video/webm .webm
AddType video/mp4 .mp4
</IfModule>
AddType image/svg+xml svg svgz
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "image/svg+xml" \
"text/css" \
"text/html" \
"text/javascript"
</IfModule>
</IfModule>
<?php
mb_internal_encoding("UTF-8");
$action = '';
$arguments = explode('/', $_SERVER['REQUEST_URI']);
$action = "default";
// function is_mail($email) {
// return filter_var($email, FILTER_VALIDATE_EMAIL);
// }
if (count($arguments) > 1) {
if (!ctype_space($arguments[1]) && !empty($arguments[1])) {
$action = $arguments[1];
}
}
if (count($arguments) > 2) {
$id = $arguments[2];
}
if ($action == "default") {
$pageTitle = "Дизайн инетерьера в Киеве";
$pageDesc = "Отличный дизайн интерьера, с учетом Ваших пожеланий, в Киеве по выгодным ценам и в оптимальные сроки от компании Good Idea";
$pageKeys = "дизайн интерьера киев выгодно ремонт квартир";
include("index_page.php");
}
else if (strtolower($action) == "sendticket"){
include("{$_SERVER['DOCUMENT_ROOT']}/sendticket.php");
}
Answer the question
In order to leave comments, you need to log in
.htaccess404.php
<?php
http_response_code(404);
?>
Страница не найдена
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question