BAD/FAKE 页面重定向到 404 页面无效

Redirection to 404 page for BAD / FAKE pages not working

*注意 - 站点确实直接指向 https 以获得 SSL 证书

好的,这是在实时站点上,所以我可以提供测试链接。

因此,如果您访问我的网站 https://thebigmmorpglist.com and put in a random fake page such as https://thebigmmorpglist.com/nosuchpage.php it will keep the url as https://thebigmmorpglist.com/nosuchpage.php but have the looks of the home page with a messed up stylesheet. Also say you go to https://thebigmmorpglist.com/12-sky-2/nosuchpage.php it will also show the home page while keeping the url as https://thebigmmorpglist.com/12-sky-2/nosuchpage.php 但根本没有样式表(可能是因为它在不同的目录中。我对如何解决这个问题感到很困惑,我相信我的重定向是正确的.htaccess 文件。

(抱歉,如果我措辞/描述有任何错误)

我已经尝试更改错误页面的位置并更改重定向代码的顺序/布局。我完全不知道我可以纠正这个问题,我在 Stack Overflow 上找不到任何可以复制我的问题的东西。

ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
</IfModule>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

RewriteEngine On
RewriteCond %{HTTP_HOST} thebigmmorpglist\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://thebigmmorpglist.com/ [R,L]

我希望虚假页面重定向到位于我的根目录中的 error.php...

由于我的站点不再是 wordpress 站点,我很愚蠢并欺骗了 https 的重定向...

必须删除此代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
</IfModule>

固定/工作代码:

ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

RewriteEngine On
RewriteCond %{HTTP_HOST} thebigmmorpglist\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://thebigmmorpglist.com/ [R,L]