Report this

What is the reason for this report?

(Error 404)-Route controller not recognized on server

Posted on February 25, 2022

Hi, i’m new to the development world. I just migrated a project from my computer(Windows local) to the server on cloud (VM Línux). I’m using a simple MVC based architecture. The question is:

1 - I did all necessery configiratios on httpd.conf file as:

   DocumentRoot "/MyProject/public"
   <Directory "/MyProject/public">
      AllowOverride all
      Require all granted
   </Directory> 

-#I uncommented the lines belowon.

  Include etc/extra/httpd-vhosts.conf
  Include etc/extra/httpd-xampp.conf

2- In the httpd-vhosts.conf file i have:

  <VirtualHost *:80>
     ServerAdmin my@email.com
     DocumentRoot "/MyProject/public"
     ServerName "MyServerName.com"
     ErrorLog "logs/MyServerName.com-error_log"
     CustomLog "logs/MyServerName.com-access_log" common
  </VirtualHost>

3- In my hosts file i added:

127.0.1.1 MyServerName.com

I’m not using any .htaccess file for application and if I should use it, I have no idea how to configure it. The project works fine on my local server (my computer), I’m using Xampp in both scenarios(Local and VM).

I just have an index.php file in the public directory with the following code:

require_once("../vendor/autoload.php");
$route = new \App\Route;

Any ideas on how to resolve this? Please! Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Do you get any specific errors when visiting your website via your browser or is it just the 404 error?

Also, are your project files available in the /MyProject/public directory on your server? You could check this with the ls -la command:

ls -la /MyProject/public

Usually, what I do myself whenever I’m having issues with my webserver is to check the error logs. For Apache, the default location of the error log should be at:

cat /var/log/apache2/error.log

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.