如何设置CodeIgniter忽略Wordpress文件夹? [英] How to set CodeIgniter to ignore Wordpress folder?

查看:131
本文介绍了如何设置CodeIgniter忽略Wordpress文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去年建立了一个网站CodeIgniter www.example.com,客户希望Wordpress博客上周。我创建了博客并上传到www.example.com/blog



现在当我点击wordpress上的任何链接时,会出现如下错误:/



http://www.example.com / blog / category / one-last-category /


遇到错误 p>

无法
加载您的默认控制器。请
确保在
中您的Routes.php文件中指定的控制器有效。


Codeigniter忽略Wordpress文件夹?



感谢有帮助!!!

解决方案

例如,在我的Codeigniter网站的DocumentRoot中,我有一个.htaccess文件,其中包含:

  RewriteEngine on 
RewriteCond $ 1!^(index\.php | static | user_guide | robots\.txt)
RewriteRule ^(。*)$ / index。 php / $ 1 [L]

这允许我仍然访问静态文件和CI用户指南。在你的情况下,RewriteCond将是这样:

  RewriteCond $ 1!^(index\.php | blog)


I built a website with CodeIgniter last year www.example.com, and client wanted Wordpress Blog last week. I built the blog and uploaded to www.example.com/blog

Now when I click any link on wordpress it gives error as below :/

http://www.example.com/blog/category/one-last-category/

An Error Was Encountered

Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.

How can I set Codeigniter to ignore Wordpress folder?

Appreciate helps!!!

解决方案

You'll want to do this with an .htaccess file (assuming your web server supports it.) For example, in the DocumentRoot of my Codeigniter site I have an .htaccess file which contains:

RewriteEngine on
RewriteCond $1 !^(index\.php|static|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

This allows me to still access static files and the CI user guide. In your case the RewriteCond would be something like:

RewriteCond $1 !^(index\.php|blog)

这篇关于如何设置CodeIgniter忽略Wordpress文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆