I just moved my website from http to https. The images, javascripts and css files have status 403 (Forbidden). I am using php codeigniter. What is it that I am missing?
add this to your .htaccess to move the entire website to 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>
Where example.com
is your own domain. you can use your local ip or localhost
for localhost
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^localhost [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*) https://localhost/$1 [L,R=301]
</IfModule>
The above solutions work at the root of your domain. if you need folder wise
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.