donglin1692 2013-12-18 21:45
浏览 49
已采纳

在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

  • 写回答

1条回答 默认 最新

  • dr5779 2013-12-19 00:01
    关注

    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)) ?>" ... 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 根据以下文字信息,做EA模型图
  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥60 关机时蓝屏并显示KMODE_EXCEPTION_NOT_HANDLED,怎么修?
  • ¥66 如何制作支付宝扫码跳转到发红包界面