Would love any help on this. It's confusing me!
This started happening suddenly and I'm not really sure why. When you type my website address, https://www.example.com
, into the address bar it redirect to https://www.example.com/dispatch.fcgi/
. What is this dispatch.fcgi
and why does it show up?
My .htaccess
file is as follows:
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}/$1 [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/$1 [QSA,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
CodePudding user response:
When you type my website address,
https://www.example.com
, into the address bar...
It's when you type HTTP://www.example.com/
(note, HTTP, not HTTPS).
This is because your directives are in the wrong order... you are redirecting to HTTPS (HTTP to HTTPS redirect) after rewriting the request to dispatch.fcgi/
. Your HTTP to HTTPS redirect should be the second rule. And your first rule that redirects from non-www to www should also redirect to HTTPS as well.
In other words, your rules should look like this:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
The additional conditions (RewriteCond
directives) - that I've omitted here for brevity - are required when renewing your SSL certs.
What is this
dispatch.fcgi
This would seem to be your front-controller. (?)