HTTPS循环重定向

时间:2018-03-21 04:40:35

标签: wordpress .htaccess

任何人都可以帮我停止在HTTP中重定向到WordPress网站中的https。

这是方案

http://example.com 301永久移动 https://example.com/ 301永久移动 https://www.example.com/ 200 OK

1 个答案:

答案 0 :(得分:2)

所以,如果我理解正确,这是你的.htaccess文件:

Option Explicit

Sub myself()

    Dim str As String
    Dim LastRow As Long
    Dim LastCol As Long
    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim i As Long
    Dim j As Long

    Dim FilePath As String

    Set ws1 = Sheets("Sheet1")
    Set ws2 = Sheets("Sheet2")


    Open "C:\Users\Antony\Desktop\test.txt" For Output As #2

    With ws1
        LastRow = .Cells(.Rows.count, 1).End(xlUp).Row
        LastCol = .Cells(1, .Columns.count).End(xlToLeft).Column

        For i = 1 To LastRow
            For j = 1 To LastCol
                str = .Range(.Cells(i, j)).Value
                Print #2, str
            Next
        Next
    End With

    Close #2

End Sub

您希望将网页从http://example.comhttps://example.com重定向到https://www.example.com - 这是正确的吗?

如果是这样,请使用:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
RewriteBase / 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule>

这样做,它将页面从非www重定向到www,然后强制https。