A
A
azazello___132020-08-11 07:50:02
URL Handling
azazello___13, 2020-08-11 07:50:02

When requesting a non-existent page, the server returns 200. Where is the problem?

Hello everybody.
When checking the site for SEO, there is such a problem
Returning status 200 when requesting a non-existent page.
It is necessary to configure it so that when requesting non-existent pages, a response code 404, “page not found”, or response code 410, “page deleted.” appears on
the site .
CUTENEWS[ST]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /news/show_news.php?cn_rewrite_url=$1 [L]
# --- CUTENEWS[ED]
If no this, then everything works. But then the blog does not work. And it is extremely important for the site.
Here is the whole .htaccess:
Options -Indexes
RewriteEngine on

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^ /errors.php [END]

# --- CUTENEWS[ST]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME } !-f
RewriteRule ^(.*)$ /news/show_news.php?cn_rewrite_url=$1 [L]
# --- CUTENEWS[ED]

# Change default directory pages.
DirectoryIndex index.php

ErrorDocument 400 /errors.php
ErrorDocument 403 /errors.php
ErrorDocument 404 /errors.php
ErrorDocument 405 /errors.php
ErrorDocument 408 /errors.php
ErrorDocument 500 /errors.php
ErrorDocument 502 /errors.php
ErrorDocument 504 /errors .php

# Redirect 301 /
RewriteCond %{HTTP_HOST} ^www.aaaa\.iii\.tt$ [NC]
RewriteRule ^(.*)$ https://aaaa.iii.tt$1 [R=301,L]

# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (www\.)?aaaa.eeee.tt
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI } [L,R=301]
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2020-08-11
@shambler81

Comrades security officers, the domain is not a SERKET, it's not your password or ssl key.
you pay money for advertising, and hide the site when you need to go to it, what is the logic brother?
so I'll tell you the secret site google.com - and ? ....
All that has been achieved is that it is harder for you to give an answer.
And that vangem
The sequence matters, because the rules are applied from top to bottom in a circle until the urls stop generating.
so what's up

Options -Indexes
RewriteEngine on
DirectoryIndex index.php

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

ErrorDocument 400 /errors.php
ErrorDocument 403 /errors.php
ErrorDocument 404 /errors.php
ErrorDocument 405 /errors.php
ErrorDocument 408 /errors.php
ErrorDocument 500 /errors.php
ErrorDocument 502 /errors.php
ErrorDocument 504 /errors.php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /news/show_news.php?cn_rewrite_url=$1 [L]

Now the question is do you have errors.php ion fulfills 404, respectively 200 it to him.
If not, then remove these directives, as a rule, the engine itself is responsible for this.
ErrorDocument 400 /errors.php
ErrorDocument 403 /errors.php
ErrorDocument 404 /errors.php
ErrorDocument 405 /errors.php
ErrorDocument 408 /errors.php
ErrorDocument 500 /errors.php
ErrorDocument 502 /errors.php
ErrorDocument 504 /errors.php

And give me the name of the site already, it is very difficult to see what is happening there when you have a cold war with the air.
< the news blog is set up on the site and for its correct operation it is written in .htaccess

EEE is the site itself or the second engine. If the second engine, then create your own .htaccess in the block folder and all of them are inherited,

A
azazello___13, 2020-08-12
@azazello

With the name of the site - gave "to the bar"
the site https://konkurentov.net.ua/
Thanks for the help, it does not help yet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question