Search code examples
phpapacheyii2http-status-code-404bootstrapping

Yii2: The requested URL /site/login was not found on this server


I have a Yii2 application working in a computer with Debian. Then I tried to run it in another computer with Windows 8 but it doesn't work.

I copied the entire application folder to Apache's htdocs folder but when I run it in a browser it shows:

404 Not Found

Apache access.log:

::1 - - [12/Jul/2018:09:03:40 -0300] "GET /donaciones-yii/backend/web/site/login HTTP/1.1" 404 235
::1 - - [12/Jul/2018:09:03:40 -0300] "GET /favicon.ico HTTP/1.1" 200 1150

This is the content of the file backend/web/index.php:

<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/main.php'),
    require(__DIR__ . '/../../common/config/main-local.php'),
    require(__DIR__ . '/../config/main.php'),
    require(__DIR__ . '/../config/main-local.php')
);

(new yii\web\Application($config))->run();

@rob_006: I don't have the backend/web/.htaccess file in Debian neither Windows computers: enter image description here


Solution

  • I solved it disabling pretty URLs.