CodeIgniter的子目录问题

Flo*_*DNA 2 php directory codeigniter codeigniter-2

我在主域(domain.com)上安装了CodeIgniter应用程序.现在我想使用一个博客目录(domain.com/blog/),我想安装一个WordPress支持的博客.但问题是我创建了一个名为博客的目录,但是当我尝试通过输入domain.com/blog/来访问它时,我得到CodeIgniter 404而不是fount页面.我对CodeIgniter很新,所以我必须在这里遗漏一些东西.

谢谢

Wes*_*rch 6

假设您正在使用从URL中.htaccess删除index.php,您应该.htaccess在项目的根目录中包含以下内容:

RewriteCond $1 !^(index\.php|robots\.txt|css|images)
RewriteRule ^(.*)$ index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

它基本上是说"发送到所有请求index.php/$request,除非他们下手index.php,robots.txt,css,或images".

这样您就不必使用像这样的URL http://example.com/index.php/controller/method.

只需添加blog:

RewriteCond $1 !^(index\.php|robots\.txt|css|images|blog)
RewriteRule ^(.*)$ index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)