1

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();
    }
}
5
  • localhost/magento2/test/product/index //magento2 replace with project name
    – Rk Rathod
    Sep 25 '19 at 11:50
  • thanks for answer but there was an issue of compilation,becuase controller classs was not generated in generated folder Sep 25 '19 at 13:00
  • static content deploy
    – Rk Rathod
    Sep 25 '19 at 13:00
  • 1
    using this : php bin/magento setup:di:compile issue solved Sep 25 '19 at 13:01
  • 1
    remove your var/cache folder then execute this command in your command promt php bin/magento setup:di:compile Sep 25 '19 at 13:53
4

remove your var/cache folder then execute this command in your command promt

php bin/magento setup:di:compile

Hope This Will Help You !!!

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.