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 !
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?
I think i have the solution
I replace ErrorDocument 404 https://www.mapaetmoi.fr/404.php
By ErrorDocument 404 /404.php
And it works !
Related
Wondered if someone can help me. I'm trying to remove a 302 redirect from one of my sites but I can't get the code correct. It works for the first http -> https but the redirect to /tt-rss/ is still being done using 302
This is what I'm using......can anyone help?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
>>> http://rss.oliroe.com
> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------
Status: 301 Moved Permanently
Code: 301
Server: nginx
Date: Wed, 05 Oct 2022 12:14:02 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 231
Connection: close
Location: https://rss.oliroe.com/
>>> https://rss.oliroe.com/
> --------------------------------------------
> 302 Found
> --------------------------------------------
Status: 302 Found
Code: 302
Server: nginx
Date: Wed, 05 Oct 2022 12:14:03 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
X-Powered-By: PHP/8.1.11
Location: /tt-rss/
Strict-Transport-Security: max-age=15768000; includeSubdomains; preload
>>> /tt-rss/
> --------------------------------------------
> 200 OK
> --------------------------------------------
Status: 200 OK
Code: 200
Server: nginx
Date: Wed, 05 Oct 2022 12:14:03 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
X-Powered-By: PHP/8.1.11
Cache-Control: public
Strict-Transport-Security: max-age=15768000; includeSubdomains; preload
I've solved this, the website had this code in the index.php header("Location: /tt-rss/");, I didn't realise redirects in php defaulted to 302. Changing the line to header("Location: /tt-rss/", true, 301); solved my issues. Many thanks
I'm seeing a situation where requests through Cloudfront have a different Cache-Control than my origin. I have Object Caching set to "Use Origin Cache Headers" and (I don't think this is relevant) Compress Objects Automatically set to "No"
I've found that if I change Object Caching to "Customize" and change the value around that does in fact change the headers returned from the CDN. That's okay and all... but I'm curious to know why with my existing settings this header isn't being passed through.
Thanks!
Compressed Request from Origin - shows Cache-Control of '31536000'
(05:34 PM) jsharpe#mbp:~ curl -I https://staging.testing.com/assets/application-0d5691ba401c3f5a305fda52745a831376545a605a6c16e50fc838fdaa567e57.css --compressed
HTTP/1.1 200 OK
Server: Cowboy
Date: Wed, 16 Aug 2017 21:34:22 GMT
Connection: keep-alive
Last-Modified: Wed, 16 Aug 2017 05:05:25 GMT
Content-Type: text/css
Cache-Control: public, max-age=31536000
Content-Encoding: gzip
Vary: Accept-Encoding, Origin
Content-Length: 33563
Via: 1.1 vegur
Compressed Request from CDN - shows Cache-Control of '86400'
(05:34 PM) jsharpe#mbp:~ curl -I https://staging-cdn.testing.com/assets/application-0d5691ba401c3f5a305fda52745a831376545a605a6c16e50fc838fdaa567e57.css --compressed
HTTP/1.1 200 OK
Content-Type: text/css
Content-Length: 33563
Connection: keep-alive
Server: Cowboy
Date: Wed, 16 Aug 2017 05:07:12 GMT
Last-Modified: Wed, 16 Aug 2017 05:05:25 GMT
Cache-Control: public, max-age=86400
Content-Encoding: gzip
Via: 1.1 vegur, 1.1 7d327ef7e21429ba6a44eb6374c976f3.cloudfront.net (CloudFront)
Vary: Accept-Encoding
Age: 59233
X-Cache: Hit from cloudfront
X-Amz-Cf-Id: TEqKbQ5ZYySY7m8rDft_MAlygEiam6gYvzrXBpS7D2DrBNbVUZ1y3Q==
I have excluded the url like this from my varnish cache
if (req.url ~ "^/folder_name/") {
return (pass);
}
but still when i access curl -I http://ip/folder_name i see the below response
HTTP/1.1 301 Moved Permanently
Date: Mon, 04 Jul 2016 08:48:46 GMT
Server: Apache/2.2.15 (CentOS)
Location: http://ip/folder_name/
Content-Length: 319
Content-Type: text/html; charset=iso-8859-1
X-Varnish: 294958
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive
Can anyone please tell me what am i doing wrong, i need to exclude
"all urls that start with /folder_name" from being cached in varnisg
Your regex ends in a slash and "http://ip/folder_name does" not - could this be it?
I have a site that uses SSL.
When I correct to the default (http://www.example.com), it supposed to load http://www.example.com
And it does, but when I use a redirect checker, I notice this:
www.accufinance.com
HTTP/1.1 302 Found
Cache-Control: private,no-transform
Content-Type: text/html; charset=utf-8
Location: https://www.accufinance.com/
Server: Microsoft-IIS/8.0
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 18 Sep 2014 00:20:43 GMT
Connection: close
Content-Length: 145
https://www.accufinance.com/
My site in on a shared host, so I used a web.config redirect.
In that, I have:
<action type="Rewrite" url="mypath/mysite/{R:1}" redirectType="Permanent"/>
Note: Since posing, I changed type="Rewrite" to type="Redirect", but no in the result. Still seems to be a 302.
So I am expecting a 301 - permanently moved, and, hoping not to see a "Not found".
What could be wrong here?
I have website which is online. When I'am using it via browser everything is ok and this page is present in browser. When I'm using it as googlebot ( via webmastertools ) i'm getting error
HTTP/1.1 404 Not Found
Date: Mon, 19 Nov 2012 09:57:37 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: symfony=55240a0a341202d07fc96cbc1c1bcca5; path=/
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
and rest of the html code...
same thing when I'm trying to validate it via wc3 validator.
Please help :( I tryied everything :(
website address is mojaczestochowa.pl
If more info is needed please let me know.
Try to check the pae with web-sniffer and set user agent to google.bot
Here is the exact query, which will simulate server's response to the GoogleBot crawler:
https://websniffer.cc/?url=http://mojaczestochowa.pl/&uak=9