Welcome Guest, Not a member yet? Register   Sign In
Run CI under Wordpress root directory
#1

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.
Reply
#2

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
Best VPS Hosting : Digital Ocean
Reply
#3

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.

Reply
#4

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
Reply
#5

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


#Options +FollowSymLinks

Reply
#6

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.

Reply
#7

@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...
Reply
#8

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.

Reply
#9

@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!
Reply
#10

Your welcome Wink

Reply




Theme © iAndrew 2016 - Forum software by © MyBB