Magento Homepage Keeps on redirecting to a 404 page

12,535

Solution 1

I've got a similar error and would like to post my solution here. The case was exactly the same for me: all the pages, categories, etc. worked perfectly, but the home page showed a 404 error.

I looked into the core_url_rewrite table and discover that there was an entry with the «request_path» field empty. So this entry was rewriting my base url and that was the reason for the 404 in my case. I just deleted it.

Hope this helps to other people.

Solution 2

If you are using the Enterprise version you should check the table enterprise_url_rewrite. The query below should help you:

select * from enterprise_url_rewrite where request_path="";
delete from enterprise_url_rewrite where request_path="";

Solution 3

Check the folowing:

1- System->Configuration->general->Web->secure Base URL: http://www.your-site.com/ (be sure you are in the right shop site from the top left of the system)

2- System->Configuration->general->Web->Default Pages Default Web URL: cms (yes just cms) CMS Home Page: select your cms page Default No-route URL: cms/index/noRoute

3- check your server has rewrites otherwise System->Configuration->general->Web->Search Engines Optimization Use Web Server Rewrites: No

4- something wrong with your .htaccess replace the file with the one in your original installer.

Solution 4

Because StackOveflow has this stupid rule that I must have a certain number of "points" before I can chime in on discussions I need to make this as a "new answer":

open-ecommerce.org's #2 also solved the problem for me

2- System->Configuration->general->Web->Default Pages Default Web URL: cms (yes just cms) CMS Home Page: select your cms page Default No-route URL: cms/index/noRoute

for me this was set to "index". No clue how it worked before, or why it was set that way, but after updating it broke and this was the fix for me.

Note that I did also truncate the 'core_url_rewrite' table as well in troubleshooting. If you don't change urls at all, or often, then that's no big deal. But if you are chaning URLs often, then you'll loose your 301 redirect history (all old urls will 404 going forward).

Share:
12,535
Ronic Winmar Concepcion
Author by

Ronic Winmar Concepcion

Updated on June 14, 2022

Comments

  • Ronic Winmar Concepcion
    Ronic Winmar Concepcion almost 2 years

    I have been on this issue for almost a week now and have been research all over the net for answers but i could not find one.

    Problem:

    each time i access the homepage of my site, it results to a 404 error.

    ex. http://www.domain.com ---> redirects to 404

    http://www.domain.com/home ---> enters to the cms page that i set as my homepage

    I have already run the magento cleanup scripts but it was not able to solve the problem.

    ERROR MESSAGE:
    
    Whoops, our bad...
    
    The page you requested was not found, and we have a fine guess why.
    
            If you typed the URL directly, please make sure the spelling is correct.
            If you clicked on a link to get here, the link is outdated.
    
    What can you do?
        Have no fear, help is near! There are many ways you can get back on track with Magento Store.
    
            Go back to the previous page.
            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
    
    • Alan Storm
      Alan Storm almost 13 years
      Which 404? (alanstorm.com/magentos_many_404_pages self-link)
    • Ronic Winmar Concepcion
      Ronic Winmar Concepcion almost 13 years
      The magento cms page 404. Can be defined in admin. edited the post, added the error message
    • clockworkgeek
      clockworkgeek almost 13 years
      Is the home page enabled for "All Store Views"? You can easily tell from the list of CMS pages.
    • Ronic Winmar Concepcion
      Ronic Winmar Concepcion almost 13 years
      yes it is enabled for all store views
    • Alan Storm
      Alan Storm almost 13 years
      What happened when you ran the debugging steps at the above link?
    • Ronic Winmar Concepcion
      Ronic Winmar Concepcion almost 13 years
      when i check it on firebut the status is 404 Not Found. i do not have ssh access to the server i cannot run the curl commands
    • Alan Storm
      Alan Storm almost 13 years
      Keep reading then, there's information that will let you trace the code to figure out why this happening.
    • Ronic Winmar Concepcion
      Ronic Winmar Concepcion almost 13 years
      Ok so i found out what the problem is ... Some of the image urls on the site were wrong. Instead of filenames it was a link to where i crawled the images from. After removing that I was able to fix the problem.
    • user487772
      user487772 almost 13 years
      It will be cool if you will put this as an answer to your question and will mark it as a correct answer, so others who have same problem will find a solution fast.
  • PHP Bugs
    PHP Bugs over 9 years
    Oh! Thanks. In my case this was table enterprise_url_rewrite. We are using the Enterprise version. Deleted the entry using the query below: select * from enterprise_url_rewrite where request_path="";
  • M Rostami
    M Rostami over 9 years
    Also check this : select * from core_url_rewrite where request_path="/";
  • davidanton1d
    davidanton1d over 3 years
    Same thing worked for me on Magento 2.4, in the table url_rewrite.