Change media folder to serve up HTTPS


#1

With Let’s Encrypt when I do GTmetrix or Pingdom test I get “Minimize redirects” where it’s asking to switch files served from http to https

The page at ‘https://mysite.com/’ was loaded over HTTPS, but requested an insecure image ‘http://mysite.com/wp-content/uploads/2016/08/hbg-1.jpg’. This content should also be served over HTTPS.

Does anyone know how to fix this, or possibly change the entire media folder to be serving HTTPS files?


#2

@Kalach the best way to do this in nginx level is using subs_filter directive.

subs_filter 'http://mysite.com' 'https://mysite.com'; this should be under server block.


#3

The correct way, IMHO, to fix this is changing the URLs in database:

cd /var/www/mysite.com/htdocs
wp search-replace http://mysite.com/ https://mysite.com/

#4

@antopjoseph @portofacil

Thank you guys for responding.

I ended up using portofacil’s method and it worked out wonderfully!

Thanks again!


#5

A side note question.

What are some other configurations or settings have to be changed when switching to https?


#6

I can’t think of anything but changing your own URLs to https.


#7