How to remove index.php from CodeIgniter3 install in subdirectory with WordPress on root?

So the title of the question was a little difficult to come up with. Here’s the deal, the CI3 install is like this: www.mydomain.com.au/apps/TGPS where TGPS is the CI application. Additionally, on the root of the web folder there is a WordPress install. My question is, what is the .htaccess setup that I need to compress the URLs from:
www.domain.com/apps/TGPS/index.php/controller/function
to this:
www.domain.com/apps/TGPS/controller/function

At present I have this:

Read More

enter image description here

The top level .htacess is this:

# BEGIN WordPress
RewriteRule ^/apps($|/) - [L] 
# END WordPress

The .htaccess in TGPS is this:

<IfModule mod_rewrite.c>
    RewriteEngine On

    #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.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #This last condition enables access to the images and css folders, and the robots.txt file
    RewriteCond $1 !^(index.php|public|images|robots.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

and the .htaccess in application is the standard one.

Seems everything I try either breaks WordPress, CodeIgniter or has no effect. Any help would be appreciated.

Related posts

2 comments

  1. At first glance, you’re missing a rewrite base:

    RewriteBase /apps/TGPS/
    
  2. Try bellow code

        RewriteEngine On
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php
    RewriteRule ^index.php$ / [L,R=301]
    

    Then the www to non-www:

    RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
    

Comments are closed.