Switch from HTTP to HTTPS except two URLs with .htaccess made in Laravel

0

I have a page made in laravel, it already has the SSL permission to be HTTPS.

Let's say it's https://www.mipagina.com but I want the paths www.mipagina.com/dondeesta and the folders that are inside " empresa " www.mipagina.com/high/empresa/latest/ are always HTTP

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/dondeesta [OR]
RewriteCond %{THE_REQUEST} !^/high/empresa/latest/
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
RewriteRule ^(.*?)$ public/$1 [L]

I already tried several examples of seeing several similar questions but none of them gives me the result I want

    
asked by Adolfo Celis 17.07.2018 в 05:28
source

1 answer

0

If these routes are placed inside the code, the only solution is to change them by hand using Laravel's own function:

// Comprueba si la página "foo" se ha cargado bajo el protocolo HTTPS
Route::get('foo', array('https', function()
{
    return 'Must be over HTTPS';
}));

Now, to force the page to be seen in https you have to use the following in .htaccess:

RewriteEngine On 
RewriteBase /

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mipagina.com/$1 [R=301,L]
    
answered by 17.07.2018 в 09:55