gpt4 book ai didi

php - 在实时服务器上部署 Codeigniter 应用程序

转载 作者:行者123 更新时间:2023-11-30 00:24:37 26 4
gpt4 key购买 nike

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

config.php

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

数据库.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>

最佳答案

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

并将您的 .htaccess Rewritebase/smthng 设置为 Rewritebase/

关于php - 在实时服务器上部署 Codeigniter 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22982858/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com