简体   繁体   中英

Site wide https with Laravel 4

I am curious to find out how people are doing site wide https with links and forms. I am familiar with URL::secure for generating a form link. It looks like you can pass https to a route to force https. Does this mean I have to set https on every route definition?

Why don't you do it using your web server? I think it's safer and you don't have to do anything else on your application.

This is my configuration for apache:

<IfModule mod_rewrite.c>
    #Options -MultiViews
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM