magento 2 shows 404 error on product detail page - magento

I am getting 404 error on ALL product detail pages. This happened right after I imported new products. Yes I did reindex several times. Everything else loads as it should. I thought maybe it is because of url rewrite module but if that was the case then I had to have the same problem for categories but I don't. Also I created a new product to see maybe there is a problem with my import file but the new product throw 404 as well.
Here is an url example for product detail(throws 404 error): http://example.com/index.php/09wx6359.html
Here is an url example for categories which works fine: http://example.com/index.php/product/resistor/film/metal.html. So Problem is not re-indexing or rewrite url. I'm using Magento 2.0.4. Please HELP

Problem was from my template files. There is an error in one of the files that renders product detail page. When I changed my template to Luma it got fixed. Such a relief I'm so happy now

For me this happened when i migrated a new staging environment. I copied the production db and uploaded my develop branch code. after all Megento commands the product pages kept saying 404.
After truncating the tables:
report_event
session
customer_visitor
Deleting some folders in the var folder with command:
rm -rf var/cache var/generation var/pagecache var/di
My product pages are working again. Magento ver. 2.1.8

This answer may help newbies to Magento 2.
If you are getting 404 message while accessing product page or category page, few things might not right. Thus, the simple one might be because of your catalog configuration that is:
Stores->Configuration->Catalog->Search Engine Optimization->Product URL Suffix
Stores->Configuration->Catalog->Search Engine Optimization->Category URL Suffix
If this value is .htmland you are accessing product or category URL like this https://www.qyqhair.co.uk/brazilian you will get 404 error. The best way to get correct URL, in this case, will be to add the .html suffix i.e. /brazilian.html.
If you want to access the page as shown in the sample URL, then, you need to remove the .html value from Product URL Suffix and or both Category URL Suffix and leave it blank.
You might want to also run this command php bin/magento indexer:reindex && php bin/magento cache:flush && php bin/magento cache:clean after you made the changes.
Hope this help someone, one day.

I got similar issue and fixed in following ways:
correct 'special price from' date
assign 'default category'
run command index:reindex
flush cache
Issue resolved.

Related

Magento 2 Attributes Price Does't Update

A friend of mine who running e-commerce website using Magento 2 platform. She set price attribute on her products and now she wants to change the price. She is able to find the attribute input field and changed the price and then saved and cashed out, but it doesn't update frontend, and there is no any error show either.
I'm pretty new to Magento 2 and wondering any body has any idea what is going on?
You must flush storage cache then run this command (from the root of magento's directory) line to get the change applied :
$ php bin/magento indexer:reindex
Let me know if you still face the problem then.
If you cannot ssh to server, you can go to admin System->Tools->Index Management to Re

Magento /admin panel doesn't work

After I copied my magento installation on a new domain. The admin panel doesn't work. I checked the .htaccess, baseurls and tried a lot of other things, still the 404 error page.
The version of my installion is 1.9.
Please follow the following step.
delete cache folder from var
if you domain name changed then open your database and select core_config_data and set secure and insecure web url to your domain specific url
if you have still further problem for css and js and you have to make merge css and js flag to 0 which is also found in core_config_data
Thanks,
Sam
I hope sagar helped you to get rid of the problem.
to my opinion this issue happens due to improper setup of the core stores in magento.
what I did to resolve the issue to check the core_store tables. Check if store admin is active.
Make it active and your 404 problem will go away.
Thanks me later !!!

Magento upgrade 1.7 to 1.9.2.2 , product frontend giving 404

I upgraded my Multi-store magento from 1.7 to 1.9.2.2.
On frontend CMS , Categories etc are working fine. but product detail pages giving 404 error.
I reindexed all indexes.
refresh all caches but still same.
Can anyone help?
It sounds like the URL rewrite is to blame. You may want to run the indexes via command line.
SSH Into the server and cd into the directory that has your magento code then use this command to run the indexes
php shell/indexer.php --reindexall
You may also want to clear you caches, and check the server logs for some hints.
404 is most certainly the URL rewrite causing the problem, so running the indexes via command line should fix that for you.

404 error when renaming (changing) store-view code in Magento 1.7.0.2

This error has been eating my head since 2 days! I have searched the entire internet!
Scene:
I have a Magento store (1.7.0.2) with 1 website, 1 store and 2 storeviews.
First store view code is my_uk_en
Second store view code is my_uk_ru
Everything works fine until I rename (change) the StoreView to something else.
I renamed the storeview code to my_cz_en, and frontend gives 404 error.
I have checked my index.php and .htaccess files, there is no store called explicitly.
I tried running the new store forecefully by using the following in index.php
$mageRunCode = "my_cz_en";
$mageRunType = "store";
Mage::run($mageRunCode, $mageRunType);
But still same 404!
I also ran a search on my entire database with the old storeview code (my_uk_en) and there was no matches.
The storeview is assigned to a CMS homepage as well. The setting Add Store Code to URL is disabled.
Inspite of all these I don't understand why I am getting 404 error.
I have found the culprit! There was this phtml file which had
Mage::app()->getStore('my_uk_en')
in it. I changed it to my new storeview code and it worked. So if anyone gets this error in future, do run a full search on your entire codebase for the old storeview code. Thanks.

Magento Homepage Keeps on redirecting to a 404 page

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
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.
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="";
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.
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).
Open-ecommerce.org solution # 2 , worked for me.
I initially set my "Defaul Web URL" as the URL of the homepage. Similar to what I did with the baseURL but I was wrong.
I changed it to "CMS"
From there, it all works.
Thanks!

Resources