在.htaccess中重定向的问题

时间:2016-09-22 05:26:42

标签: .htaccess redirect mod-rewrite

我的.htaccess将访问者重定向到https://palabi.net时出现问题。所有带www和/或http的请求都应重定向到此网址。我在另一个域上拥有相同的设置(没有FilesMatch,并且它完美无缺。任何想法为什么它都不起作用?

这是我的.htaccess-setup:

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=604800, public"
</FilesMatch>

<IfModule mod_rewrite.c>

    # No WWW
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.palabi\.net$ [NC]
    RewriteRule ^(.*)$ http://palabi.net/$1 [L,R=301]


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

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

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

0 个答案:

没有答案