2017-02-23 91 views
0
RewriteRule ^(.*)$ public/$1 [L] 

如何重定向这个(我的网站位于子文件夹)
如何所有路由重定向到为https?重定向所有路由HTTPS/SSL在Laravel与htaccess的

这是正确的

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{HTTPS} !=on 
    RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
    RewriteRule ^(.*)$ public/$1 [L] 
</IfModule> 

回答

0

您可以在当前之前使用此规则。

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

请参阅更新 – Nikanor

1

试试这个

RewriteCond %{HTTPS} off 
# First rewrite to HTTPS: 
# Don't put www. here. If it is already there it will be included, if not 
# the subsequent rule will catch it. 
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
# Now, rewrite any request to the wrong domain to use www. 
# [NC] is a case-insensitive match 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]