t waThe requested URL /site/abous not found on this server.

Hello

Sorry for my English.

There have been many times about this but I can not find what would help me.

The application works but when I switch ‘enablePrettyUrl’ => from ‘false’ to ‘true’ for example the page /site/about shows The requested URL /site/about was not found on this server.

Home page works all the time

PHP Version 5.4.4

app source directory:


/var/yii

apache directory


/var/www

Index.php (/var/www/index.php)


<?php

defined('YII_DEBUG') or define('YII_DEBUG', true);

defined('YII_ENV') or define('YII_ENV', 'dev');




require( '/var/yii/vendor/autoload.php');

require( '/var/yii/vendor/yiisoft/yii2/Yii.php');

require( '/var/yii/common/config/bootstrap.php');

require( '/var/yii/frontend/config/bootstrap.php');


$config = yii\helpers\ArrayHelper::merge(

    require( '/var/yii/common/config/main.php'),

    require( '/var/yii/common/config/main-local.php'),

    require( '/var/yii/frontend/config/main.php'),

    require( '/var/yii/frontend/config/main-local.php')

);


$application = new yii\web\Application($config);

$application->run();

.htaccess code


RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

main.php (/var/yii/common/config)


<?php

return [

    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',

    'components' => [

		

    'cache' => [

            'class' => 'yii\caching\FileCache',

        ],

	'urlManager' => [

		'enablePrettyUrl' => true,

		'showScriptName' => false,

		'rules' => [

		'dashboard' => 'site/index'

		],

] 

    ],

	

];

please help

In your .htaccess code try this


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.)\?$ index.php/$1 [L,QSA]


Thank you but is the same.

Do you have access to the apache configuration?

  • you should set/add

AllowOverride All

in the default configuration!

  • restart the apache server

Thanks -> mod_rewrite not working. After 30 minutes of fighting with the launch of the mod_rewrite module I decided to start a new server