How to set up CakePHP project on windows server

Follow the below steps to successfully get your CakePHP project running along side your WordPress website:

  1. Edit below lines in .htaccess file in the root(Home) directory.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^CakePHPFolder/(.*)$ / CakePHPFolder /$1 [L,QSA]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

2. Create the web.config file in CakePHP Project folder and put the below code in it.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Exclude direct access to webroot/*"
                  stopProcessing="true">
                    <match url="^webroot/(.*)$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
                  stopProcessing="true">
                    <match url="^(font|img|css|files|js|favicon.ico)(.*)$" />
                    <action type="Rewrite" url="webroot/{R:1}{R:2}"
                      appendQueryString="false" />
                </rule>
                <rule name="Rewrite requested file/folder to index.php"
                  stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php"
                      appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

3) In .htaccess file of cakePHP project remove the line RewriteRule ^(\.well-known/.*)$ $1 [L].

Your cakePHP is set up now.

If you are using Mysql8 its not supported to it.

Leave a comment

79 − 73 =

Instagram

Facebook

Linked In

Copyright © 2019 by Blue Creazione. All rights reserved.