CodeIgniter Forums
Run CI under Wordpress root directory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Run CI under Wordpress root directory (/thread-361.html)

Pages: 1 2


Run CI under Wordpress root directory - vrsotto - 11-25-2014

Hi Guys,

I'm wondering if anyone came across with this issue. basically, under the root directory are Wordpress core files and folders. now, my CI project folder is also in the root. my problem is, i can't access my CI, since WP htaccess is overriding the CI (htaccess). the URL's are for example are:

www.wp-project.com <-- Wordpress
www.wp-project.com/ciproject <-- CI

can anyone please help how.

Thanks much in advanced.


RE: Run CI under Wordpress root directory - sv3tli0 - 11-25-2014

Try adding at CI htaccess
Code:
RewriteBase /

and please post your htaccess's for both WP and CI so we can help you easier Smile


RE: Run CI under Wordpress root directory - Rufnex - 11-25-2014

Have you in both directories a htaccess file? Normaly if you have also one in /ci/ it should be overwrite the one from the main site.


RE: Run CI under Wordpress root directory - vrsotto - 11-25-2014

Hi Rufnex and sv3tli0,

here are the .htaccess for both. 

WP: this is in the main root directory (something, /var/www) 

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


For CI: is on sub-folder (like: /var/www/ciproject/public_html)

<IfModule mod_rewrite.c>

  Options +FollowSymLinks
  RewriteEngine on

  # Send request via index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

and in config.php i set something like, $config['base_url'] = 'http://www.wp-project.com/ciproject/';

By the way, i'm not really familiar with .htaccess.

hope you guys can further help. 

Thanks Again


RE: Run CI under Wordpress root directory - Rufnex - 11-25-2014

Try first to remove this line (or comment it out):


#Options +FollowSymLinks


RE: Run CI under Wordpress root directory - Rufnex - 11-25-2014

You have to write your RewriteBase in the CI folders .htacces

Code:
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /ciproject/public_html
  # Send request via index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

config.php

$config['base_url'] = '';

This works for me.


RE: Run CI under Wordpress root directory - vrsotto - 11-25-2014

@Rufnex, your second method partially work. like if i type http://www.wp-project.com/ciproject, it will bring me to page "index of /ciproject" with list links "parent directory" and "public_html". clicking "public_html" will bring me to the CI default controller "http://www.wp-project.com/ciproject/public_html/admin/users/login" (the "public_html/" part in the URL should be omited). once logged, i'm being brought to the dashboard page ("/ciproject/public_html/admin/dashboard").

the remaining issues now i think:
- is how do i redirect user to default controller ("http://www.wp-project.com/ciproject/public_html/admin/users/login" without "public_html/" part) once type http://www.wp-project.com/ciproject

- how to remove "public_html/" part in the url

Hope you'll still be with me in this issue and thanks much for the response...


RE: Run CI under Wordpress root directory - Rufnex - 11-26-2014

I dont understand excatly the problem. In the htaccess you have defined the RewriteBase. That is the base for your project.

RewriteBase /ciproject/public_html

Just move all files from public_html to /ciproject and correct the RewriteBase to

RewriteBase /ciproject

should help you.


RE: Run CI under Wordpress root directory - vrsotto - 11-26-2014

@Rufnex

it work now. basically i moved "application" and "system" folders up from root directory. put all files and folders of "public_html" up one level.

thanks so much for your help!


RE: Run CI under Wordpress root directory - Rufnex - 11-27-2014

Your welcome Wink