问题
I 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' => '/',
回答1:
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
回答2:
Just a shot in the dark, but as you mentioned:
hat my project working very nice on windows(on apache server ),then I moved my project to ubuntu 12.04 (apache2 server)
Please check the use of capital and small initial letters of your rewrite rules, paths, etc., they must exactly match when you're on Linux, because Linux usually uses a case-sensitive file system, while many Windows and Mac installations don't.
回答3:
If you think that you've checked the configuration of your web server seriously, and didn't not found something suspecting, then just give it a try to reload and restart or reboot the Apache HTTP Server:
sudo service apache2 reload
sudo service apache2 restart
Don't forget, even some software applications required to reboot your computer to install the new upgrade.
来源:https://stackoverflow.com/questions/15715556/the-requested-url-frontend-ru-site-login-was-not-found-on-this-server