简体   繁体   English

将混合内容http转换为https

[英]convert mix content http to https

I recently added a ssl certificate to my website. 我最近在我的网站上添加了ssl证书。 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. 现在的问题是,某些元素(例如图像,字体等)是外部内容,这些外部内容在"src=http://example.com/jpg"标签中使用http。

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. 我知道可以通过在我的元素标签中用https替换http来解决问题,但是我至少有133个网页需要一些时间才能手动完成。

Is there any other alternative that I can use? 我还有其他选择吗?

Can I use .htaccess for this problem? 我可以使用.htaccess解决此问题吗?

note - I am using cpanel hosting 注意-我正在使用cpanel托管

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

.htaccess is not going to help you here as it is used for redirecting http to https in websites. .htaccess不会在这里为您提供帮助,因为它用于将http重定向到网站中的https

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 . 因为使用cpanel意味着您无权访问根服务器,因此,唯一的选择是将http手动转换为https

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM