yarek
yarek

Reputation: 12044

redirect ALL trafic including JS/CSS to https

I have https installed but websites uses ABOSLUTE http:// links

I tried to solve that with .htaccess such as:

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

But still images and JS are fetched from http and not from https which gives me errors.

How can I force ALL to be fetched by HTTPS ? (including JS and Images) using .htaccess

Upvotes: 0

Views: 2881

Answers (1)

Bananaapple
Bananaapple

Reputation: 3114

This will take any http request made to your site and 301 redirect it to the https equivalent:

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

Upvotes: 1

Related Questions