所请求的URL /前端/ RU /网站/登录/在此服务器上找到 [英] The requested URL /frontend/ru/site/login/ was not found on this server
问题描述
我有一个问题,我的项目工作的非常漂亮的窗口(Apache服务器上),那么我搬到我的项目到Ubuntu 12.04(Apache2的服务器),但我的项目不工作。
的Apache2
PHP 5.3.10
的MySQL 5.5.29-ubuntu0.12.04.2
这是Firebug的:
块引用><!DOCTYPE HTML PUBLIC - // IETF // DTD HTML 2.0 // ENGT&;
< HTML和GT;< HEAD>
<标题> 404未找到< /标题>
< /头><身体GT;
< H1>未找到< / H1>
< P>将请求的URL /前端/ RU /网站/登录/在此服务器上找到< / P>
<小时>
<地址>的Apache / 2.2.22(Ubuntu的)在test.local端口80℃的服务器; /地址>
< /身体GT;< / HTML>但我有网址
/前端/ RU /网站/登录/
。main.php:
//取消以下定义路径别名
Yii的:: setPathOfAlias('网站',目录名(__ __ FILE)DIRECTORY_SEPARATOR'..'DIRECTORY_SEPARATOR'..'。);//这是主要的Web应用程序的配置。任何可写的
// CWebApplication类属性可以在此处配置。
返回阵列(
基本路径'=>的dirname(__ __ FILE)DIRECTORY_SEPARATOR'..',。
'名'=>'生物记录后台',
'语言'= GT; RU,
defaultController'=>公司/名单, // preloading'登录'组件
'preLOAD'=>阵列('登录','ELangHandler'), //自动加载模型和组件类
'进口'= GT;阵列(
'site.common.models。*',
'site.common.components。*',
'application.models。*',
'application.components。*',
'application.components.helper。*',
'application.modules.rights。*',
'application.modules.rights.components。*',
) '模块'= GT;阵列( GII'=>阵列(
类= GT;'system.gii.GiiModule',
'密码'=>'795138462',
//如果去掉,GII默认只本地主机。精心编辑的味道。
ipFilters'=>阵列('127.0.0.1',':: 1'),
generatorPaths'=>阵列(
site.common.gii',//псевдонимпути
//'application.gii',
)
) WEBSHELL'=>阵列(
类= GT;'ext.webshell.WebShellModule',
//键入退出的时候,用户会被重定向到该网址
exitUrl'=> '/',
解决方案你没有给予足够的信息,所以我们猜测,但我相当肯定,问题是Apache的重写模块。首先,确保你的.htaccess文件包含以下内容:
RewriteEngine叙述上#如果目录或文件是否存在,直接使用它
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d#否则将其转发到index.php
重写规则。的index.php接下来,确保重写模块已启用:
a2enmod重写
最后,请确保Apache的配置为允许.htaccess压倒一切的:
所有的AllowOverride
在这里看到有关AllowOverride指令的详细信息:
<一href=\"http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride\">http://httpd.apache.org/docs/2.2/mod/core.html#allowoverrideI have a problem, that my project working very nice on windows(on apache server ),then I moved my project to ubuntu 12.04 (apache2 server), but my project do not working.
apache2
php 5.3.10
mysql 5.5.29-ubuntu0.12.04.2
on firebug:
<!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>
But I have the 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' => '/',
解决方案You're not giving enough information, so we have to guess, but I'm fairly sure that the problem is in apache rewrite module. First of all, make sure your .htaccess file contains the following:
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
Next, make sure that rewrite module is enabled:
a2enmod rewrite
And finally, make sure that apache is configured to allow .htaccess overriding:
AllowOverride All
See here for more information about AllowOverride directive: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
这篇关于所请求的URL /前端/ RU /网站/登录/在此服务器上找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!