I tried to setup a test laravel project with HTTPS but only the root / is correctly routed, I can see other pages if I write the url like
http://ift.tt/2rJZUzc
while
myapp.com/test
returns a 404 error.
There is a lot of posts about this behaviour but no solution worked for me and I think that's because they are not using SSL. I tried every permutation of solution I managed to found with no success.
This is my .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /staging/public/
# Force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
this is myapp config file in sites-available:
<VirtualHost *:80>
DocumentRoot /var/www/staging/public
ServerName staging.app.com
<Directory "/var/www/staging/public">
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =staging.app.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
and this is SSL config file in sites-available
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin my.address@example.com
ServerName staging.app.com
DocumentRoot /var/www/staging/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/http://ift.tt/2t39IrV
SSLCertificateKeyFile /etc/letsencrypt/live/http://ift.tt/2rKe837
Include /etc/letsencrypt/options-ssl-apache.conf
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/lib/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sYBQfs
via IFTTT
Aucun commentaire:
Enregistrer un commentaire