簡體   English   中英

網站從http遷移到https

[英]Migration of website from http to https

我只是將我的網站從http移到了https。 圖像,JavaScript和CSS文件的狀態為403(禁止)。 我正在使用php codeigniter。 我想念的是什么?

將此添加到您的.htaccess中,以將整個網站移至https

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^example\.com [NC]
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*) https://example.com/$1 [L,R=301]
</IfModule>

其中example.com是您自己的域。 您可以使用本地IP或localhost

對於本地主機

<IfModule mod_rewrite.c>    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^localhost [NC]
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*) https://localhost/$1 [L,R=301]
</IfModule>

上述解決方案在您域的根目錄下有效。 如果您需要明智的文件夾

<IfModule mod_rewrite.c>
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} !^example\.com [NC]
    RewriteCond %{SERVER_PORT} 80 
    RewriteCond %{REQUEST_URI} folder 
    RewriteRule ^(.*)$ https://example.com/folder/$1 [R,L]
</IfModule>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM