Magento2 : How To Solve Controller 404 Not Found Error On Live Server
-
14-03-2021 - |
Question
I have create one controller and it is working fine in local environment but when i upload that files to live server is shows 404 not found error,
These are my code, please let me know if anyone have idea about this issue.
controller URL: http://127.0.0.1/test/product/index
app/code/Vendor/Test/etc/frontend/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="test" frontName="test">
<module name="Vendor_Test"/>
</route>
</router>
</config>
app/code/Vendor/Test/Controller/Product/Index.php
<?php
namespace Vendor\Test\Controller\Product;
use Magento\Framework\App\Action\Action;
class Index extends Action
{
public function execute()
{
echo "hello1";
die();
}
}
Solution
remove your var/cache folder then execute this command in your command promt
php bin/magento setup:di:compile
Hope This Will Help You !!!
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange