*注意-网站直接指向用于SSL cert的https
好的,这是在一个活的网站上,所以我可以给出链接来测试。
因此,如果你访问我的网站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 ...
发布于 2019-04-19 02:57:01
由于我的网站不再是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]
https://stackoverflow.com/questions/55751806
复制相似问题