本文介绍了WordPress + Codeigniter htaccess令人困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在具有以下htaccess的根目录中安装了Wordpress:

I have Wordpress installed in the root directory with the following htaccess :

# BEGIN WordPress
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我将Codeigniter安装在名为members的子目录中,并具有以下htaccess:

and I have Codeigniter installed in a sub-directories named members, with the following htaccess :

RewriteEngine on
RewriteBase /members/
RewriteCond $1 !^(index\.php|images|templates|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

当我尝试通过以下方式访问任何控制器:site.com/members/controller/function时,出现Wordpress 404错误页面

When I try to access any controller via : site.com/members/controller/function I get the Wordpress 404 error page

推荐答案

在CI config.php中,将基本URL设置为

In your CI config.php, set your base url as

$config['base_url'] = 'http://site.com/members/'

并更改

 RewriteBase /members/

RewriteBase /

在您的CI .htaccess文件中.这样,当您访问CI时,它不会在根目录(即WP)中查找,而是直接进入其目录并绕过WP.

in your CI .htaccess file. This way when you access CI, it doesn't look in the root (which is WP), it goes straight to it's directory and bypasses WP.

这篇关于WordPress + Codeigniter htaccess令人困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:06