CodeIgniter Forums
Excluding a uri from Codeigniter handling it? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Excluding a uri from Codeigniter handling it? (/showthread.php?tid=25829)



Excluding a uri from Codeigniter handling it? - El Forum - 12-27-2009

[eluser]behdesign[/eluser]
I've installed Wordpress to the /blog subdirectory of my web project that otherwise uses Codeigniter. How do I configure CI to ignore requests to the Wordpress directory so I can finish installation and use the admin interface. Eventually, I'll AJAX the content from the blog into the pages in CI, so keeping the content in the same domain is important.

Thanks!


Excluding a uri from Codeigniter handling it? - El Forum - 12-27-2009

[eluser]Jelmer[/eluser]
The issue is with the rewriting of the server: you don't tell CI to ingore it because it should never reach CI to begin with.

Rewriting is probably done with a .htaccess file like the example in the User Guide:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

You have to add "blog" to the paths to ignore, by adding it to the RewriteCond:
Code:
RewriteCond $1 !^(index\.php|images|robots\.txt|blog)

If your .htaccess looks a lot different you have to find the RewriteRule line that rewrites to the index.php and add an additional RewriteCond:
Code:
RewriteCond $1 !^(blog)



Excluding a uri from Codeigniter handling it? - El Forum - 12-27-2009

[eluser]richthegeek[/eluser]
there is another way to do it, which is with a "file/dir exists" condition;
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

That will catch any files that exist on the server and stop them being passed to CI.


Excluding a uri from Codeigniter handling it? - El Forum - 12-27-2009

[eluser]Jelmer[/eluser]
That's my preferred way as well, however that would still supercede any rewriting rules for Wordpress - so you still need a RewriteCond for /blog/