Apache:找不到具有HTTPS的URL

时间:2019-01-17 09:32:25

标签: apache .htaccess https http-status-code-404

我网站上的每个请求都重定向到特定的PHP文件(handle.php)。对于HTTP请求,这很好用,但是当我在URL中强制使用HTTPS时,效果不佳。

这有效(HTTP): http://my.domain.com/myrequest

这可用于(HTTPS): https://my.domain.com/handle.php (每次对特定文件的请求在HTTPS中都可以正常运行)

这不起作用(HTTPS): https://my.domain.com/myrequest (找不到404)

简而言之,当我强制使用HTTPS并尝试发出需要重定向到handle.php的请求时,就会出现问题。

起初,我认为不允许HTTPS请求,但是如您所见,当您请求特定文件时,它可以正常工作,因此我认为重定向存在问题。

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^ handle.php [L]
</IfModule>

VirtualHost Config

NameVirtualHost *:80
<VirtualHost *:80>
        ServerAdmin admin
        ServerName my.domain.com
        ServerAlias my.domain.com
        DocumentRoot /data/www/my.domain.com/docroot/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /data/www/my.domain.com/docroot/>
                Options FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI MultiViews SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /data/www/my.domain.com/logs/error.log
        LogLevel warn
        CustomLog /data/www/my.domain.com/logs/access.log combined
        ServerSignature On
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
        ServerName my.domain.com
        DocumentRoot /data/www/my.domain.com/docroot/
        SSLEngine on
        CustomLog /data/www/my.domain.com/logs/ssl-access.log combined
        ErrorLog /data/www/my.domain.com/logs/ssl-error.log
        SSLCertificateFile /data/www/my.domain.com/certs/cert.crt
        SSLCertificateKeyFile /data/www/my.domain.com/certs/cert.key
        <Directory /data/www/my.domain.com/docroot/>
                Require all granted
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

0 个答案:

没有答案