将所有HTTP网址重定向到HTTPS以进行magento中的前端

编程入门 行业动态 更新时间:2024-10-21 14:37:45
本文介绍了将所有HTTP网址重定向到HTTPS以进行magento中的前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想将所有http网址重定向到magento中的https,但仅用于前端.在magento中,我们有一种设置,可以使用安全的前端URL,如此链接中所述: https ://www.siteground/tutorials/magento/magento_ssl.htm ,但这仅适用于登录或签出后显示的页面.

I want to redirect all http urls to https in magento, but for front-endonly. In magento we have a setting to use secure urls for front-end as explained in this link: www.siteground/tutorials/magento/magento_ssl.htm but that applies to only pages shown after login or checkout.

我在.htaccess文件中应用了以下代码:

I have applied following code in my .htaccess file:

RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ %{HTTP_HOST}/$1 [R,L]

可以,但是也可以将管理面板的URL重定向到https.我不想要那样,我只希望前端不保护管理面板网址.

It is working ok, but it is redirecting Admin panel urls to https as well. I don't want that, I want only front-end to secure not the admin panel urls.

请检查并告知我们是否可以在magento中进行此类操作?

Please check and advise if we can do such thing in magento?

推荐答案

首先删除您的规则.

然后,按照此参考转到您的管理区域.转到系统">配置">"Web">安全",然后打开在前端使用安全URL"和在管理员中使用安全URL"选项.

Then, as per this reference go to your admin area. Go to System > Configuration > Web > Secure and turn on the options "Use secure URLS in frontend" and "Use secure URLS in admin".

您网站上的链接现在都应为https.您可以使用以下规则来重定向为您的网站的http版本添加了书签的用户:

Links on your website should now all be https. You can use the following rule to redirect people that bookmarked the http-version of your site:

RewriteCond %{HTTPS} off RewriteRule ^ example%{REQUEST_URI} [R,L]

在测试一切正常之后,将R标志更改为R=301.

Change the R flag to R=301 after testing everything works as expected.

更多推荐

将所有HTTP网址重定向到HTTPS以进行magento中的前端

本文发布于:2023-10-31 15:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546559.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   网址   HTTP   HTTPS   magento

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!