实时服务器上的Codeigniter应用程序部署

时间:2014-04-10 08:38:04

标签: php mysql

我打算在实时服务器上部署我的应用程序,它在本地服务器上工作正常但在实时服务器上我收到错误消息:“在此服务器上找不到请求的文档。”这里提到的必要配置可能有助于回答。我可以访问我的CSS& JS放置在应用程序文件夹外部但不重定向到我的控制器/方法/视图。请建议

的config.php

$config['base_url'] = 'http://mydomain.org';

database.php中

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'mydomain.org';
$db['default']['username'] = 'myuser';
$db['default']['password'] = 'mypwd';
$db['default']['database'] = 'myDB';

routes.php文件

$route['default_controller'] = "admin/user/login";
on my localhost
$route['default_controller'] = "welcome"; is also working fine

的.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cicms

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 

1 个答案:

答案 0 :(得分:0)

在welcome.php文件旁边创建一个index.php文件,并将代码,函数放在那里,并将其作为默认控制器。 CI引擎不会将文件夹内的文件作为其default_controller读取。一旦试试这个。曾经帮助过我......

并将.htaccess Rewritebase / smthng设为Rewritebase /