How to set CodeIgniter to ignore Wordpress folder?

限于喜欢 提交于 2019-12-04 13:55:31

问题


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!!!


回答1:


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)


来源:https://stackoverflow.com/questions/4567473/how-to-set-codeigniter-to-ignore-wordpress-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!