php - BAD / FAKE页面重定向到404页面不起作用
问题描述
*注意 - 网站确实指向 https 以获取 SSL 证书
好的,这是在一个实时站点上,所以我将能够提供链接进行测试。
因此,如果您访问我的网站https://thebigmmorpglist.com并放入一个随机的假页面,例如https://thebigmmorpglist.com/nosuchpage.php它将保持 URL 为https://thebigmmorpglist.com/nosuchpage.php但是有一个混乱的样式表的主页的外观。还说你去https://thebigmmorpglist.com/12-sky-2/nosuchpage.php它也会显示主页,同时将 url 保持为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/$1 [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/$1 [R,L]
推荐阅读
- php - PHP/PDO:将数据插入外部列
- java - 添加另一个项目 jar 作为资源
- javascript - 关于 querySelectorAll 声明的问题
- python - 被 BeautifulSoup 抓取后正确格式化表格
- c# - 关系“公寓”不存在 EFCORE postgre sql
- excel - Outlook 主题行限制
- swift - 为什么我变成精灵节点的这张图像的不透明度不会改变?
- tensorflow - 在 Keras 或 Tensorflow.Keras 中,命令“models.load_model”完全没有任何作用
- python - 如何创建可以查看特定规格的多个数据列表
- redis - Redis Sentinel Slave SDOWN 设置为 True