将所有HTTP网址重定向到HTTPS以进行magento中的前端 [英] Redirect all HTTP urls to HTTPS for frontend in magento

查看:122
本文介绍了将所有HTTP网址重定向到HTTPS以进行magento中的前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将所有http网址重定向到magento中的https,但仅用于前端.在magento中,我们有一种设置,可以使用安全的前端URL,如此链接中所述: https ://www.siteground.com/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: https://www.siteground.com/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 ^(.*)$ https://%{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 ^ https://example.com%{REQUEST_URI} [R,L]

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

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

这篇关于将所有HTTP网址重定向到HTTPS以进行magento中的前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆