htaccess的问题强制SSL问题、htaccess、SSL

2023-09-02 10:10:42 作者:+ \" 視覺系〃梓 x \"

我对我的一个网站(基于字preSS)激活SSL和要修改的.htaccess 修改内容的链接为https。 我的意思是,到 https://www.example.com/products.html 页面是一个 https://m.xsw88.com/allimgs/daicuo/20230902/296.png.JPG 我想把它通过的.htaccess 更改为 https://m.xsw88.com/allimgs/daicuo/20230902/298.png.jpg 和我没有任何想法! :| 我安装和激活 HTTPS的Word preSS 插件,但一些链接不更改为https。

I activated SSL on one of my sites (based on wordpress) and want to modify .htaccess to modify content's links to https. I mean, into https://www.example.com/products.html page is a https://m.xsw88.com/allimgs/daicuo/20230902/301.png.jpg i want to change it to https://m.xsw88.com/allimgs/daicuo/20230902/298.png.jpg via .htaccess and i don't have any idea! :| I installed and activated HTTPS for WordPress plugin but some links not change to https.

推荐答案

先生。舒尔曼的解决方案忘记了域名之后的斜线,这样用户会被重定向到 的https:// WWW .example.comcategory / CAT1 / CAT2 / 这是不完全正确。我加了一个斜线给他的.htaccess项,和它的工作就好了。试想一下:

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. I added a slash to his .htaccess entry, and it worked just fine. Consider:

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