重定向到404页面,BAD / FAKE页面无法正常工作

问题描述 投票:0回答:1

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

好的,这是在一个现场网站,所以我将能够提供测试链接。

因此,如果您访问我的网站https://thebigmmorpglist.com并放入一个随机的虚假页面,如https://thebigmmorpglist.com/nosuchpage.php,它将保持网址为https://thebigmmorpglist.com/nosuchpage.php但具有混乱的样式表的主页外观。还要说你去https://thebigmmorpglist.com/12-sky-2/nosuchpage.php它也将显示主页,同时保持网址为https://thebigmmorpglist.com/12-sky-2/nosuchpage.php但没有STYLESHEET在所有(可能是因为它在一个不同的目录。我很困惑如何解决这个问题,我相信我有重定向在我的.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 ...

php .htaccess web redirect url-redirection
1个回答
0
投票

由于我的网站不再是一个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]
© www.soinside.com 2019 - 2024. All rights reserved.