CloudFlare SSL(htaccess)重定向到laravel上的index.php

CloudFlare SSL(htaccess)重定向到laravel上的index.php,laravel,web,https,Laravel,Web,Https,我正在使用laravel,我无法将客户端重定向到https和www。 例如: 发件人: 致: 这是我的.htaccess代码: RewriteCond %{HTTP:X-Forwarded-Proto} !https # First rewrite to HTTPS:A # Don't put www. here. If it is already there it will be included, if not # the subsequent rule will catch it. Re

我正在使用laravel,我无法将客户端重定向到
https
www
。 例如:

发件人:

致:

这是我的
.htaccess
代码:

RewriteCond %{HTTP:X-Forwarded-Proto} !https

# First rewrite to HTTPS:A
# 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.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
它已经重定向到
https://www.
但它总是重定向到
index.php
文件


例如,不是重定向到
https://www.domain.com/abc
它重定向到
https://www.domain.com/index.php

好的,我已经修好了。我只需要把这个代码放在laravel的代码之前:

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
因此,现在的完整访问权限是:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} !https
# First rewrite to HTTPS:A
# 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.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

选项-多视图
重新启动发动机
重写cond%{HTTP:X-Forwarded-Proto}!https
#首先重写到HTTPS:A
#不要把www.放在这里。如果已经存在,将包括在内,如果没有
#随后的规则将捕获它。
重写规则。*https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]
#现在,将任何请求重写到错误的域以使用www。
重写cond%{HTTP_HOST}^www\。
重写规则。*https://www.%{HTTP_HOST}%{REQUEST_URI}[L,R=301]
#重定向尾部斜杠。。。
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]