How to redirect 404 page to home page?

  • If my answer solves your concern then there is green right tick mark, hit that tickmark for right answer that will help future readers. – Nikunj Vadariya Jun 9 '18 at 6:14

Login to the admin and go to System > Configuration > Web and change the drop-down value for CMS No Route Page in the Default Pages section. You should be able to select your Home Page.

enter image description here

Second method by .htaccess:

For example, if you wish to redirect the 404 (File Not Found) errors to http://example.com, you should add this line to your .htaccess file:

ErrorDocument 404 http://example.com



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]

Or you can try like this way too,add the following code & replace YOURURL with the URL where you want the error 404 page redirected to.

ErrorDocument 404 http://YOURURL

Try this one: Note: If you have a specific 404 Url that you want to redirect to the homepage. Here's how to redirect the target path should be "../"

1. Catalog > Url Rewrite Management

enter image description here

2. Click Add URL Rewrite

enter image description here

3. Select Custom Url Rewrite

enter image description here

4. Add your desired 404-page link in here.

enter image description here

I hope this helps. Guys out there just correct me if I'm wrong. But I'm doing this one a lot in my regular tasks.

  • This will getting error – YKB Jun 7 '18 at 9:54
  • What do you mean @YKB? – MazeStricks Jun 7 '18 at 9:57
  • Yes, I'm getting error message, when I was passing my Request url and Target url. – YKB Jun 7 '18 at 10:22
  • Can you show me a screenshot of the error? Or what does the error says? And can you send me over the specific 404 page url from your site? Thanks – MazeStricks Jun 7 '18 at 12:02

In 404 cms page, call .phtml file with this code. There will write a code like,

header(“HTTP/1.1 404 Not Found”);
header(“Location: /”);  // Redirect to home page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.