Wordpress + Codeigniter htaccess confusing

2019-07-23 12:49发布

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

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]

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

2条回答
该账号已被封号
2楼-- · 2019-07-23 13:32

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

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

and change

 RewriteBase /members/ 

to

RewriteBase /

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.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-07-23 13:36
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cidir
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
查看更多
登录 后发表回答