Htaccess重定向Laravel 4

Net*_*eto 4 regex .htaccess mod-rewrite redirect laravel-4

我有一个Laravel 4安装,我使用样板的htaccess来重定向我的网站:

site.com.brwww.site.com.br(注意WWW).

但是当我使用像site.com.br/TITLE-OF-MY-POST我被重定向到的路线时:

www.site.com.br/index.php 代替 www.site.com.br/TITLE-OF-MY-POST"

有谁知道为什么?在这里我的htaccess规则:

Laravel的统治

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

Boilerplate的规则

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

anu*_*ava 5

更改规则的顺序:

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

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

</IfModule>
Run Code Online (Sandbox Code Playgroud)

通常在您的内部重写规则之前保留301规则.