mod_rewriting fun with two .htaccess files…one for wordpress and one for CI in a subdirectory – Education Career Blog

I have a weird situation that’s come up, so I’m hoping some one can help me out.

I have a wordpress installation in the root directory and a codeigniter installation in a subdirectory (I know, I know…). Both are working fine on their own. The codeigniter installation has its own .htaccess file for rewriting to index.php.

But what if I wanted a URL outside of the codeigniter directory to rewrite to the codeigniter directory, which will then be rewritten again by the CI .htaccess file.

For example:

example.com/2010/10/article-title is a URL used by wordpress. THIS WORKS
example.com/codeigniter/ is the root of codeigniter. THIS WORKS
example.com/codeigniter/controller/action is a CI URL. THIS WORKS

But what if I wanted to point

example.com/users/list to example.com/codeigniter/users/list 

and then have this be properly rewritten by CI?

Is this possible to do without a hard redirect?

,

In your root directory .htaccess write above the WordPress rules:

RedirectMatch Permanent ^/users/(.*) /codeigniter/users/$1

Leave a Comment