Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set CodeIgniter to ignore Wordpress folder?

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

like image 567
designer-trying-coding Avatar asked Dec 03 '25 08:12

designer-trying-coding


1 Answers

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)
like image 122
GrayB Avatar answered Dec 06 '25 03:12

GrayB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!