我有一个使用Laravel开发的生产站点。配置SSL后,只有主域才能使用https。没有其他路线。它说“ 404”未找到。但是,相同的链接也适用于Http。
服务器详细信息: PHP 7.1.29 阿帕奇2.4.6 操作系统:Centos 7 Laravel 5.4。*
.htacess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTPS} !on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php70___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
vhost.conf(站点名称替换为示例)
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
Redirect permanent / https://example.com/
DocumentRoot /var/www/html/example.com/public
ErrorLog /var/log/httpd/example.com/error.log
CustomLog /var/log/httpd/example.com/access.log combined
<Directory "/var/www/html/example.com/public">
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
#ssl configure
<VirtualHost *:443>
SSLEngine on
DocumentRoot /var/www/html/example.com/public
ServerName example.com
ServerAlias www.example.com
#SSLProtocol -All +TLSv1 +TLSv1.1 +TLSv1.2
SSLCertificateFile "/etc/pki/tls/certs/example/example.crt"
SSLCertificateKeyFile "/etc/pki/tls/certs/example/example.key"
SSLCACertificateFile "/etc/pki/tls/certs/example/example.ca-bundle"
</VirtualHost>