为什么 dispatch.fcgi 出现在我的地址栏中?

Why does dispatch.fcgi show up in my address bar?

希望得到任何帮助。这让我很困惑!

这突然开始发生,我不太确定为什么。当您在地址栏中输入我的网站地址 https://www.example.com 时,它会重定向到 https://www.example.com/dispatch.fcgi/。这是什么dispatch.fcgi,为什么会出现?

我的.htaccess文件如下:

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
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 ^(.*)$ http://www.%{HTTP_HOST}/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
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 ^(.*)$ dispatch.fcgi/ [QSA,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"

When you type my website address, https://www.example.com, into the address bar...

当您输入 HTTP://www.example.com/(注意,HTTP,而不是 HTTPS)时。

这是因为您的指令顺序错误...您正在重定向到 HTTPS(HTTP 到 HTTPS 重定向) 将请求重写为 dispatch.fcgi/ 之后。您的 HTTP 到 HTTPS 重定向应该是第二条规则。从 non-www 重定向到 www 的第一条规则也应该重定向到 HTTPS。

换句话说,您的规则应如下所示:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/ [R=301,L]

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/ [QSA,L]

续订 SSL 证书时需要额外的 条件RewriteCond 指令)——为简洁起见,我在此处省略了这些条件。

What is this dispatch.fcgi

这似乎是您的 front-controller。 (?)