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教程有興趣的朋友有所協助。