开发者

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

开发者 https://www.devze.com 2023-03-24 07:05 出处:网络
I have WordPress ins开发者_开发技巧talled 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?

I have WordPress ins开发者_开发技巧talled 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:

<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.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消