Hello.
I am using magento 2 with a custom theme. When I try create new controller with action it loads fine but all css/js links on that page looks not correct and not loading.
Code of Index.php
<?php namespace TestProject\HelloWorld\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\Controller\ResultFactory; class Index extends Action implements HttpGetActionInterface { public function execute() { return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } }
When I load default pages (for example homepage) CSS styles links looks like this (CustomTheme/WorkTeam - it is a name of the my custom theme)
/static/frontend/CustomTheme/WorkTeam/en_US/css/styles-m.css
but from my helloworld/index/index all links on CSS and JS files have
/static/frontend/_view/en_US/css/styles-m.css
Code generate wrong path with "_view" in link and those files not loading. What I am doing wrong?
Duke
You just need to update the apache2.conf file.
On Ubuntu 16.04
1. Open and edit the file /etc/apache2/apache2.conf
2. Navigate to the place in the apache2.conf file
3. Change ""AllowOverride None"" to ""AllowOverride All""
4. Save the file
5. Restart apache2 -> sudo service apache2 restart.