在此服务器上找不到请求的URL /前端/ ru/site/login /

Sar*_*mov 0 apache apache2 yii

我有一个问题,我的项目在Windows(在Apache服务器上)工作非常好,然后我将我的项目移动到ubuntu 12.04(apache2服务器),但我的项目不工作.

的Apache2

php 5.3.10

mysql 5.5.29-ubuntu0.12.04.2

在萤火虫上:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /frontend/ru/site/login/ was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at test.local Port 80</address>
</body></html>
Run Code Online (Sandbox Code Playgroud)

但我有URL /frontend/ru/site/login/.

main.php:

// uncomment the following to define a path alias
Yii::setPathOfAlias('site',dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'Biotrack Backend',
    'language' => 'ru',
    'defaultController'=>'company/list',

    // preloading 'log' component
    'preload'=>array('log', 'ELangHandler'),

    // autoloading model and component classes
    'import'=>array(
        'site.common.models.*',
        'site.common.components.*',
        'application.models.*',
        'application.components.*',
        'application.components.helper.*',
        'application.modules.rights.*',
        'application.modules.rights.components.*',
    ),

    'modules'=>array(

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'795138462',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
            'generatorPaths'=>array(
                'site.common.gii',   // ????????? ????
                //'application.gii',
            ),
        ),

        'webshell'=>array(
            'class'=>'ext.webshell.WebShellModule',
            // when typing 'exit', user will be redirected to this URL
            'exitUrl' => '/',
Run Code Online (Sandbox Code Playgroud)

Pav*_*dic 8

你没有提供足够的信息,所以我们必须猜测,但我很确定问题出在apache重写模块中.首先,确保您的.htaccess文件包含以下内容:

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php
Run Code Online (Sandbox Code Playgroud)

接下来,确保启用了重写模块:

a2enmod rewrite
Run Code Online (Sandbox Code Playgroud)

最后,确保apache配置为允许.htaccess覆盖:

AllowOverride All
Run Code Online (Sandbox Code Playgroud)

有关AllowOverride指令的更多信息,请参见此处:http: //httpd.apache.org/docs/2.2/mod/core.html#allowoverride


sch*_*unk 5

只是在黑暗中拍摄,但正如你提到的:

帽子我的项目在Windows上运行非常好(在apache服务器上),然后我将我的项目移动到ubuntu 12.04(apache2服务器)

请检查您的重写规则,路径等的大写字母和小写字母的使用情况,它们必须与您在Linux上完全匹配,因为Linux通常使用区分大小写的文件系统,而许多Windows和Mac安装不会吨.