Installing CodeIgniter on root and WordPress in sub-directory Installing CodeIgniter on root and WordPress in sub-directory codeigniter codeigniter

Installing CodeIgniter on root and WordPress in sub-directory


I suspect you could get this to work using an .htaccess file in the root directory of your site. If blog is the name of the subdirectory where WordPress is installed, and you want example.com/blog to be handled by WordPress, try this to see if it helps:

RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt|blog)RewriteRule ^(.*)$ /index.php/$1 [L]


+1 with Rich's method

Additionnaly, if you're using a .htaccess file like the one suggested on CI doc, it should work by dropping WP directory directly into web root dir.

RewriteEngine OnRewriteBase /#Removes access to the system folder by users.#Additionally this will allow you to create a System.php controller,#previously this would not have been possible.#'system' can be replaced if you have renamed your system folder.RewriteCond %{REQUEST_URI} ^system.*RewriteRule ^(.*)$ /index.php/$1 [L]#Checks to see if the user is attempting to access a valid file,#such as an image or css document, if this isn't true it sends the#request to index.phpRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d#This last condition enables access to the images and css folders, and the robots.txt file#Submitted by Michael Radlmaier (mradlmaier)RewriteCond $1 !^(index\.php|robots\.txt|corporate|assets)RewriteRule ^(.*)$ index.php/$1 [L]

Because of the RewriteCond %{REQUEST_FILENAME} !-f and RewriteCond %{REQUEST_FILENAME} !-d any call made directly to a real file on webserver would be served directly by Apache, other uris wil be handled by CI's routing mecanism.

Notice we used a last RewriteCond directive to exclude calls to certains files, including our assets dir (containing images/css/js static files) and 'corporate' dir which contains in this case a blog.

Although this example do not use wordpress, it has its own url-rewriting and routing system.

In a matter of conclusion, you'll have use a specific RewriteCond statement if you want to use WP url-rewriting, if not it could work without it.


It should work just as you described it without any complicated configuration. Just install codeigniter in your root directory and then create a blog directory and put wordpress in there.