skip to Main Content

I recently added a ssl certificate to my website. Now the problem is that some of the elements like images, fonts etc. are external content which is using http in "src=http://example.com/jpg" tag.

I know I can solve the problem by just replacing http with https in my elements tag but I have at-least 133 web-pages that will take a while to do it manually.

Is there any other alternative that I can use?

Can I use .htaccess for this problem?

note – I am using cpanel hosting

2

Answers


  1. .htaccess is not going to help you here as it is used for redirecting http to https in websites.

    as you are using cpanel that means you dont have access to your root server therefore your only option is to manually convert http to https.

    Login or Signup to reply.
  2. try this

    RewriteEngine On
    
    ### WWW & HTTPS
    
    # ensure www.
    RewriteCond %{HTTP_HOST} !^www. [NC]
    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # ensure https
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    ### WWW & HTTPS
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search