skip to Main Content

I have a .htaccess file with several redirect rules and also this line :
ErrorDocument 404 https://www.mapaetmoi.fr/404.php

However when I type a url that does not exist such as https://www.mapaetmoi.fr/test/error, and I analyze the header, I have this:
URL: https://www.mapaetmoi.fr/test/error

HTTP / 1.1 302 Found
Date: Wed, 28 Jul 2021 14:25:28 GMT
Content-Type: text / html; charset = iso-8859-1
Connection: keep-alive
Server: Apache
Location: https://www.mapaetmoi.fr/404.php

HTTP / 1.1 404 Not Found
Date: Wed, 28 Jul 2021 14:25:28 GMT
Content-Type: text / html; charset = UTF-8
Connection: keep-alive
Server: Apache
X-Powered-By: PHP / 7.3
Set-Cookie: PHPSESSID = a10d873a06024ca42cf32d4ac4ae87ea; path = /; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: PHPSESSID = a10d873a06024ca42cf32d4ac4ae87ea; expires = Fri, 27-Aug-2021 14:25:28 GMT; Max-Age = 2592000; path = /; secure; HttpOnly; SameSite = Strict

So it looks like there is a 302 redirect to my 404.php page which does return the 404 code

For SEO, I would like it to return code 404 directly. So I must have done something wrong but I can’t seem to find …

An idea ? Thank you !

2

Answers


  1. Chosen as BEST ANSWER

    I reduced the htaccess file to :

    DirectoryIndex index.php Options +FollowSymlinks Options -Indexes ErrorDocument 404 https://www.mapaetmoi.fr/404.php

    And the issue is the same.

    I wonder if it could not come from the point of the domain name (managed by a provider A) on the hosting (managed by a provider B)? Do you think this could be the case?


  2. I think i have the solution
    I replace ErrorDocument 404 https://www.mapaetmoi.fr/404.php
    By ErrorDocument 404 /404.php

    And it works !

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search