HTaccess始终重定向到ssl

时间:2019-02-18 06:59:24

标签: .htaccess ssl

这是我的htacess文件

i ant可以从非ssl重定向到ssl,也可以在此处解决任何问题。我想我缺少了什么!

RewriteEngine On
RewriteBase /
Options All -Indexes
RewriteCond %{REQUEST_METHOD} POST [NC]
RewriteRule ^ - [L]
ErrorDocument 403 /www.13clients.com/error404.php
RewriteCond %{HTTP_REFERER} !^https://(www\.)?13clients.*$ [NC] 

RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ https://%{HTTPS_HOST}/$1 [L,R=301]

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTPS_HOST}/$1 [R=301,L]

# redirect /dashboard?u=1 to /u/1
RewriteCond %{THE_REQUEST} \s/+dashboard(?:\.php)?\?(u)=(\d+)\s [NC]
RewriteRule ^ /%1/%2? [R=301,L]

# internally rewrite /u/1 to /dashboard.php?u=1
RewriteRule ^(u)/(\d+)$ dashboard.php?$1=$2 [L,QSA,NC]

# redirect /search?search=1 to /search/1
RewriteCond %{THE_REQUEST} \s/+search(?:\.php)?\?(search)=(\d+)\s [NC]
RewriteRule ^ /%1/%2? [R=301,L]

# internally rewrite /search/1 to /search.php?search=1
RewriteRule ^(search)/(\d+)$ search.php?$1=$2 [L,QSA,NC]

RewriteCond %{THE_REQUEST} \s/+enterprise\.php\?url=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L]

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ enterprise.php?url=$1 [L,QSA]


<IfModule mod_php5.c>
    #Session timeout
    php_value session.cookie_lifetime 99200
    php_value session.gc_maxlifetime 99200
</IfModule>

这是哪里出了问题吗???我想从非ssl重定向到ssl,还要查看是否有任何丢失或多余的代码。

0 个答案:

没有答案