CodeIgniter Forums

Full Version: codeigniter app in wordpress (subdomain) sub folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a main site say www.abc.com, with htaccess for the main site

I have another domain  ww.efd.com hosted on the main site subfolder `/efd.com` (WordPress)  it has this htaccess
   
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>


Now I have a CodeIgniter app www.efd.com/app hosted on subdirectory of the WordPress site /app, here is the htaccess
   
Code:
<IfModule mod_rewrite.c>
    RewriteEngine off
    RewriteBase /efd.com/app
    
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    </IfModule>

here is the directory structure


Code:
/www
.file1
.file2
.etc

      /worpresssite.com     
      .file1
      .file2
      .etc
           /codeigniter
           .file1
           .file2
           .etc

when I try to access a subfolder in the app hosted under WordPress www.efd.com/app/login, I get a 404 error, but when I access www.efd.com/app the login screen of the `app` loads correctly.
Try without the leading / on your index.php file.
Code:
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /efd.com/app
   
   RewriteCond %{REQUEST_URI} ^system.*
   RewriteRule ^(.*)$ index.php?/$1 [L]
   
   RewriteCond %{REQUEST_URI} ^application.*
   RewriteRule ^(.*)$ index.php?/$1 [L]
   
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

At the moment you are telling Apache to look at the root of the domain efd.com not efd.com/app
It seems the worpress htaccess is interfering with the htaccess or codeigniter, is there anyway i can confirm this and make them play together?
I have had trouble with this in the past. CI website with wordpress in sub folder is no problem. The other way round is very difficult and I did not find a reliable solution to it. In the end I just did an alternative approach.

Sorry - no help at all,

Paul
EDIT: I just saw you got "RewriteEngine off" in your example. And even in my code I copied for you. That's why it ain't working.

Mine works fine with this. I even got both of them in a subfolders.

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

# END WordPress

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|vendor|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

Or if this works better for you:
Code:
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /wordpress/app/
   RewriteCond $1 !^(index\.php|resources|vendor|robots\.txt)
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ /wordpress/app/index.php/$1 [L,QSA]
</IfModule>
With wordpress in a subfolder there seems to be no problem. The problem I had in the past was when wordpress was in the root and CI in a sub folder.