Magento有默認的404頁面,若是想自定義一個404頁面,又該如何作呢?html
首先,先來看下默認的404頁面:
1.Magento的CMS部分,能夠經過定義它來改變錯誤頁面,登陸後臺admin->CMS->Pages:app
2.打開404 Not Found頁面,點擊左側的Content,就能夠看到404頁面的詳情:frontend
3.如今來從新定義下404頁面,好比,輸入如下代碼:this
<div class="page-head-alt"> <h3>D'oh! That page can't be found.</h3> <p><strong>Don't get angry, and don't cry.</strong> 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 .</p> <p>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,</p> </div> <dl> <dt>Perhaps you are here because:</dt> <dd> <ul class="disc"> <li>The page has moved</li> <li>The page is no longer exists</li> <li>You were looking for your puppy and got lost</li> <li>You like 404 pages</li> </ul> </dd> </dl> <dl> <dt>What can you do?</dt> <dd>Have no fear, help is near! There are many ways you can get back on track with Magento Demo Store.</dd> <dd> <ul class="disc"> <li><a onclick="history.go(-1);" href="#">Go back</a> to the previous page.</li> CMS and Design 30 <li>Use the search bar at the top of the page to search for your products.</li> <li>Follow these links to get you back on track!<br /><a href="/">Store Home</a><br /><a href="/customer/account/">My Account</a></li> </ul> </dd> </dl>
4.點擊save page,從新打開,能夠看到404頁面已經發生變化。spa
方法一,是經過在後臺配置修改,除此以外,還須要知道的是,修改404頁面,也能夠經過修改模板來更改。code
1.首先要將CMS中的404 Not Found 的狀態改爲disable。htm
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.再次打開前臺頁面,查看是否與上述代碼內容一致,前臺頁面爲:get
4.由此,能夠經過修改模板文件來修改404頁面。it