How to make that my laravel 5.8 site always works with https://www. prefix ? In .htaccess i wrote
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
RedirectMatch 404 /\.git
# RewriteRule ^$ info.php [QSA]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
But looks like RewriteRule is not applicable is some case when I run url like “mysite.com” browser redirects “https://mysitede.com”. Also to be sure that I work https in my app/Providers/AppServiceProvider.php I have :
class AppServiceProvider extends ServiceProvider
{
use funcsTrait;
public function boot()
{
if( $this->isHttpsProtocol() ) { // check I am not on local server
\URL::forceScheme('https');
}
Which is the decision ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire