在Magento中将表单从http提交到https

在Magento中将表单从http提交到https

问题描述:

Currently I would like to redirect my contacts page from http to https.

I have managed to redirect this single page in the .htacces file by adding the following code:

RewriteCond %{HTTPS} off
RewriteRule ^(contacts/.*)$ https://www.domain.com/$1 [R=301,L]

This code works for my domain.

The problem arrives when I click on submit. The form does not submit correct after the redirect is turned on. The message of the indexcontroller: "Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us" is not appearing and we do not receive an email. For now I turned redirecting off in the .htacces file.

The contacts.xml can be found in app/design/front/base/default/layout/contacts.xml form.phtml is in app/design/frontend/base/default/template/contacts/form.phtml

I copied these two files in to my template in case I need to change them. I tried my utter best to find something similair, but I could not find anything that works. Please help.

Thanks in advance

目前我想将我的联系人页面从http重定向到https。 p>

我设法通过添加以下代码在.htacces文件中重定向此单页: p>

  RewriteCond%{HTTPS} off 
RewriteRule ^(contacts /.*)$  https://www.domain.com/$1 [R = 301,L] 
  code>  pre> 
 
 

此代码适用于我的域。 p>

当我点击提交时问题就到了。 重定向打开后,表单无法正确提交。 indexcontroller的消息:“您的查询已提交并将尽快回复。感谢您与我们联系”没有出现,我们也没有收到电子邮件。 现在我在.htacces文件中重定向了。 p>

contacts.xml可以在app / design / front / base / default / layout / contacts.xml form.phtml中找到 在app / design / frontend / base / default / template / contacts / form.phtml p>

我将这两个文件复制到我的模板中以防我需要更改它们。 我尽力找到类似的东西,但我找不到任何可行的东西。 请帮助。 p>

提前致谢 p> div>

Take a look @ Magento - Option to Remove product from cart within product view page

config.xml

<config>
    <modules>
        <MagePal_Contacts>
            <version>0.6.0</version>
        </MagePal_Contacts>
    </modules>
    <frontend>
        <routers>
            <secure_url>
                <contact>/contact/</contact>
            </secure_url>
            <contacts>
                <use>standard</use>
                <args>
                    <modules>
                        <MagePal_Contacts before="Mage_Contacts">MagePal_Contacts</MagePal_Contacts>
                    </modules>
                    <frontName>contacts</frontName>
                </args>
            </contacts>
        </routers>

       ...

Then change the form action to

<form action="<?php echo $this->getUrl('', array('_secure'=>true)) . 'contacts/index/post' ?>" ... 

or

<form action="<?php echo $this->getUrl('contacts/index/post', array('_secure'=>true)) ?>" ...