Magento如何自訂404頁面?

來源:互聯網
上載者:User
Magento修改404頁面

Magento有預設的404頁面,如果想自訂一個404頁面,又該如何做呢?

方法一

首先,先來看下預設的404頁面:

1.Magento的CMS部分,可以通過定義它來改變錯誤頁面,登入後台admin->CMS->Pages:

2.開啟404 Not Found頁面,點擊左側的Content,就可以看到404頁面的詳情:

3.現在來重新定義下404頁面,比如,輸入以下代碼:

    

D'oh! That page can't be found.

Don't get angry, and don't cry. Let us take that burden. It's not your fault. No, really, listen to me. It's not your fault. We have a 24 hour hotline to deal with things just like this. Okay, its not really a hotline, its really just some encouraging words to keep trying, but hotline sounds so much .

Sorry but the page you are looking for cannot be found. If you're in denial and think this is a conspiracy that cannot possibly be true,

Perhaps you are here because:
  • The page has moved
  • The page is no longer exists
  • You were looking for your puppy and got lost
  • You like 404 pages
What can you do?
Have no fear, help is near! There are many ways you can get back on track with Magento Demo Store.
  • Go back to the previous page.
  • CMS and Design 30
  • Use the search bar at the top of the page to search for your products.
  • Follow these links to get you back on track!
    Store Home
    My Account

4.點擊save page,重新開啟,可以看到404頁面已經發生變化。

方法二

方法一,是通過在後台配置修改,除此之外,還需要知道的是,修改404頁面,也可以通過修改模板來更改。

1.首先要將CMS中的404 Not Found 的狀態改成disable。

2.找到 no-route.phtml頁面,路徑為app/design/frontend/base/default/
template/cms/default/no-route.phtml,開啟,會看到如下代碼:

There was no 404 CMS page configured or found.

3.再次開啟前台頁面,查看是否與上述代碼內容一致,前台頁面為:

4.由此,可以通過修改模板檔案來修改404頁面。

以上就介紹了Magento如何自訂404頁面?,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.