Home  >  Article  >  Backend Development  >  How to customize 404 page in Magento?

How to customize 404 page in Magento?

WBOY
WBOYOriginal
2016-07-29 08:58:021263browse

Magento Modify 404 Page

Magento has a default 404 page. If you want to customize a 404 page, how should you do it?

Method 1

First, let’s take a look at the default 404 page:
How to customize 404 page in Magento?
1. Magento’s CMS part, you can change the error page by defining it, log in to the backend admin->CMS->Pages:

2. Open the 404 Not Found page and click Content on the left to see the details of the 404 page:
How to customize 404 page in Magento?

3. Now redefine the 404 page, for example, enter the following code:

<code><div>
    <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>
            <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>
            <li><a  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></code>

4. Click save page, reopen it, you can see that the 404 page has changed.
How to customize 404 page in Magento?

Method 2

Method 1 is to modify the configuration in the background. In addition, you also need to know that modifying the 404 page can also be changed by modifying the template.

1. First, change the status of 404 Not Found in CMS to disable.

2. Find the no-route.phtml page, the path is app/design/frontend/base/default/
template/cms/default/no-route.phtml, open it, you will see the following code:

<code>There was no 404 CMS page configured or found.</code>

3. Open the front page again and check whether it is consistent with the above code content. The front page is:
How to customize 404 page in Magento?

4. From this, you can modify the 404 page by modifying the template file.

The above introduces how to customize the 404 page in Magento? , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn