CakePHP application in a sub-folder and WordPress in root, how to modify htaccess to make it work?

I have WordPress installed in public_html i.e, root folder and have CakePHP installed in a sub-folder that is public_html/CakeApp. How do I modify htaccess to make this work?

htaccess file in public_html right now reads:

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

When I access mydomain.com/CakeApp it is re-directed to mydomain.com/CakeApp/users/login but all it shows is a WordPress 404 error.

Related posts

Leave a Reply

1 comment

  1. Add one more condition for WordPress rewrite rule:

    RewriteCond %{REQUEST_URI} !^/CakeApp [NC]
    

    Your .htaccess then should look like this:

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
    
       RewriteRule ^index.php$ - [L]
    
       RewriteCond %{REQUEST_URI} !^/CakeApp [NC]
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
    </IfModule>