Php 在根目录和子目录中的WordPress上安装CodeIgniter

Php 在根目录和子目录中的WordPress上安装CodeIgniter,php,wordpress,codeigniter,Php,Wordpress,Codeigniter,我想创建一个网站,其中的主要网页将从CodeIgniter服务。我将使用/blog/子目录中的Wordpress来主持博客。就这样!我不要别的了。只是为了确保: example.com/somepage/调用CI控制器,其中example.com/blog/some-post/由Wordpress处理 我不需要CI和WP之间的任何集成或交互 可以这样安装吗?如果没有,有什么变通办法可以让我实现目标吗 感谢和问候, Masnun它应该像您描述的那样工作,没有任何复杂的配置。只需在根目录中安装cod

我想创建一个网站,其中的主要网页将从CodeIgniter服务。我将使用/blog/子目录中的Wordpress来主持博客。就这样!我不要别的了。只是为了确保:

example.com/somepage/调用CI控制器,其中example.com/blog/some-post/由Wordpress处理

我不需要CI和WP之间的任何集成或交互

可以这样安装吗?如果没有,有什么变通办法可以让我实现目标吗

感谢和问候,
Masnun

它应该像您描述的那样工作,没有任何复杂的配置。只需在根目录中安装codeigniter,然后创建一个博客目录并将wordpress放入其中

我怀疑您可以使用站点根目录中的.htaccess文件来实现这一点。如果blog是安装WordPress的子目录的名称,并且您希望example.com/blog由WordPress处理,请尝试以下操作以查看是否有帮助:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|blog)
RewriteRule ^(.*)$ /index.php/$1 [L]
+1用里奇的方法

另外,如果您使用的是CI doc上建议的.htaccess文件,那么它应该通过将WP目录直接放到web根目录中来工作

RewriteEngine On
RewriteBase /

#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]

#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 %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)


RewriteCond $1 !^(index\.php|robots\.txt|corporate|assets)
RewriteRule ^(.*)$ index.php/$1 [L]
因为
RewriteCond%{REQUEST\u FILENAME}-f
重写cond%{REQUEST_FILENAME}-d
直接在Web服务器上调用真实文件的任何调用都将直接由Apache提供服务,其他URI将由CI的路由机制处理

注意,我们使用了最后一个
RewriteCond
指令来排除对某些文件的调用,包括我们的资产目录(包含图像/css/js静态文件)和“corporate”目录(在本例中包含博客)

虽然这个示例不使用wordpress,但它有自己的url重写和路由系统


总之,如果你想使用WP-url重写,你必须使用一个特定的
RewriteCond
语句,否则没有它也行。

谢谢。从表面上看,它应该是有效的。我要试试这个。这就是我们将CI与其他应用程序/网站集成的方式。这两种方式都可能被拒绝:将CI应用程序转换为wordpress目录,以及将wordpress转换为CI应用程序目录。@Rich Miller这对我不起作用。你能检查一下这个问题吗?这个答案对我来说非常准确,因为上面标记的正确答案弄乱了我的资产文件