In XAMPP server, When you type the URL with https://localhost/ shows error 404 File or directory not found.

Solution,

We need to check the DocumentRoot directory in httpd-ssl.conf file.

#  cd /opt/lampp/etc/httpd.conf

<IfModule ssl_module>
# XAMPP
<IfDefine SSL>
Include etc/extra/httpd-ssl.conf
</IfDefine>
</IfModule>
Include etc/extra/httpd-ssl.conf

Open the file and update document root path,
 
#   vim /opt/lampp/etc/extra/httpd-ssl.conf

<VirtualHost _default_:443>
DocumentRoot "/opt/lampp/htdocs"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog /opt/lampp/logs/error_log
TransferLog /opt/lampp/logs/access_log
DocumentRoot  "/opt/lampp/htdocs"

Finally restart Xampp,
 
#  /opt/lampp/lampp restart