简体   繁体   English

.htaccess问题强制使用SSL

[英].htaccess issue to force SSL

I activated SSL on one of my sites (based on wordpress) and want to modify .htaccess to modify content's links to https. 我在我的一个网站上激活了SSL(基于wordpress),并希望修改.htaccess以修改内容到https的链接。
I mean, into https://www.example.com/products.html page is a http://example.com/blah-blah.jpg 我的意思是,进入https://www.example.com/products.html页面是http://example.com/blah-blah.jpg
i want to change it to https://www.example.com/blah-blah.jpg via .htaccess and i don't have any idea! 我想通过.htaccess将其更改为https://www.example.com/blah-blah.jpg ,我不知道! :| :|
I installed and activated HTTPS for WordPress plugin but some links not change to https. HTTPS for WordPress插件安装并激活了HTTPS for WordPress但有些链接没有更改为https。

Mr. Schulman's solution forgets the slash after the domain name, so the user is redirected to https://www.example.comcategory/cat1/cat2/ which is not quite right. Schulman先生的解决方案忘记了域名后面的斜杠,因此用户被重定向到https://www.example.comcategory/cat1/cat2/ ,这是不对的。 I added a slash to his .htaccess entry, and it worked just fine. 我在他的.htaccess条目中加了一个斜线,它运行得很好。 Consider: 考虑:

RewriteCond %{HTTPS} off
RewriteRule (.*)  https://example.com/$1 [R]

Try putting this in .htaccess : 试着把它放在.htaccess

RewriteCond %{HTTPS} off
RewriteRule (.*)  https://www.example.com$1 [R]

Of course this will require that you have mod_rewrite enabled. 当然这需要你启用mod_rewrite

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

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