I'm trying to write a fairly simple extension that can save data to an admin grid. I've been using the Magento CMS module as an example of this, I have my grid, I can click new and enter data, but when I click save I get a 404 on this page:


I'm struggling to work this out as everything else works


<router id="admin">
     <route id="smashing_testimonials" frontName="smashing_testimonials">
          <module name="Smashing_Testimonials"/>

I have a Save.php in this path


Part of my ui_component file:


<dataSource name="smashing_testimonial_form_data_source">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
            <submitUrl path="smashing_testimonials/testimonials/save"/>
        <dataProvider class="Smashing\Testimonials\Model\Testimonial\DataProvider" name="smashing_testimonial_form_data_source">

The "submitURL" is where Magento knows where to look for my save logic right? It certainly sends me to that admin url when I click save, so I presume this is correct?

I've run all the usual setup:upgrade, setup:static-content:deploy, cache:clean, etc.

What am I missing here?

  • Add your controller code – Sohel Rana Mar 12 '19 at 18:02
  • Hi Sohel, I have changed my controller file to the version suggested below by Sweety but still hitting a 404 error. If I am getting a 404 presumably Magento isn't even finding the relevant file? I will also add my ui_component file. – William Oakley Mar 13 '19 at 11:15
  1. Change your routes.xml file
<router id="admin">
        <route id="smashing_testimonials" frontName="smashing_testimonials">
            <module name="Smashing_Testimonials" before="Magento_Adminhtml" />

  1. Change your controller file

namespace Smashing\Testimonials\Controller\Adminhtml\Testimonials;

class Save extends \Magento\Backend\App\Action
    public function execute()


  1. Create layout file (smashing_testimonials_testimonials_save.xml)


 <referenceContainer name="content">
            <block class="Smashing\Testimonials\Block\Adminhtml\Index\Index" name="testimonials_block_adminhtml_index_index"  template="Smashing_Testimonials::testimonials_index_index.phtml" />
  1. Create testimonials_index_index.phtml file


// your phtml file code
  1. Run below command
1. bin/magento setup:di:compile
2. bin/magento c:f
3. chmod -R 777 var/ pub/ generated/

Now you can successfully access your file.

| improve this answer | |
  • Thanks, I have tried this but no luck, I have added extra info to my original post. – William Oakley Mar 13 '19 at 11:20

Turns out it was a case sentivitivty thing.

I had to change



| improve this answer | |

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.