【问题标题】:Change of Magento contacts page URL on magento 2.1.9在 magento 2.1.9 上更改 Magento 联系人页面 URL
【发布时间】:2018-01-02 11:26:44
【问题描述】:

我认为 Magento 2.1 改变了修改联系页面 url 的方式。 旧教程不再适用,如下所示:(Change of Magento contacts page URL)。

也许我也做错了什么。

谁能帮帮我?

我将不胜感激。

【问题讨论】:

  • 是的,你是对的。您可以创建一个静态块并放置接触块。之后创建一个联系人类别并在该类别中分配该静态块
  • 我认为它可以工作,但是要做一件应该很简单的事情还有很长的路要走。你知道不一样的吗?谢谢你的时间。

标签: php magento magento2.1


【解决方案1】:

您需要覆盖 vendor\magento\module-contact\etc\frontend\ 文件夹中的 routes.xml 文件

改变

<code>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="contact" frontName="contact">
            <module name="Magento_Contact" />
        </route>
    </router>
</config>

</code>

到:

<code>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="YOUR_Choice" frontName="YOUR_Choice">
            <module name="Magento_Contact" />
        </route>
    </router>
</config>

</code>

【讨论】:

    【解决方案2】:
    Here you have to Add 2 URL Rewrite 
    For example for login
    1) 
        Request Path : customer/account/login
        Target Path : login
        Redirect Type : Permanent (301)
    
    2 (another rewrite for same )
    
       Request Path : login
        Target Path :  customer/account/login
        Redirect Type : NO
    
    Hope fully it will works.
    In both url call perform same operations
    

    【讨论】:

    • 我尝试了你的教程,但它不起作用。请记住,我不想重定向 url,我想更改 url。还是谢谢
    【解决方案3】:

    你可以使用.htacess编写如下代码

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.example.com [NC]
    RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]
    or you can do with admin panel also
    

    1st->进入admin->marketing->seo&search->urlrewrite 根据您的要求更改网址

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-28
      • 1970-01-01
      • 2013-07-16
      • 1970-01-01
      相关资源
      最近更新 更多