Laravel 5.2 .htaccess不起作用

时间:2017-01-07 08:29:11

标签: .htaccess laravel laravel-5 digital-ocean cloudflare

我想从网址中删除我的公共文件夹,并希望将http强制为https。

我正在使用此

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://{REQUEST_URI} [L,R=301] 

此代码仅适用于删除公共但不适用于http到https

1 个答案:

答案 0 :(得分:0)

删除公用文件夹

1. Move the .htaccess file from public folder to main folder.
then Rename the server.php to index.php
Now the myproject/public/ is changed to myproject/.

对于htaccess

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

我希望这会对你有所帮助。谢谢