【发布时间】:2019-12-12 18:18:10
【问题描述】:
我想将我的 CI 项目从本地主机传输到实时服务器,所以我使用 FTP 客户端将我所有的 CI 项目文件夹复制到 public_html 文件夹。
我也修改了config.php base_url file、routes.php default_controller、.htaccess directory。但没有任何效果。
public_html 目录树:
.htaccess:
RewriteEngine On
RewriteBase
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
config.php:
$config['base_url'] = 'http://xxxxxxxx.com/';
Others 目录包含我的 css/js/img 文件,并且都是使用 base_url() 调用的,所以我认为这不是问题
public_html文件夹中的.htaccess文件被隐藏;我不知道为什么,但是当我搜索时,它是在这里找到的。
【问题讨论】:
-
您在 routes.php 中做了哪些更改(将文件移动到实时服务器时无需进行更改)?
-
@Tpojka 我的意思是,确保我的 default_controller 是我使用的那个。什么都没改变,只是说没关系。以防万一有人问这个!
-
在
.htaccess中,您需要RewriteBase的值,即如果它位于服务器的根目录中,我想这是因为文件夹名称public_html、RewriteBase / -
@Tpojka 刚刚尝试
RewriteBase /并刷新了我的网站。 404 未找到!
标签: php .htaccess codeigniter mod-rewrite