Rewriting cakephp path in cakephp 3.0 Rewriting cakephp path in cakephp 3.0 wordpress wordpress

Rewriting cakephp path in cakephp 3.0


Add .htaccess to your domain root folder:

<IfModule mod_rewrite.c>    RewriteEngine on    RewriteRule    ^$    cake_app/    [L]    RewriteRule    (.*) cake_app/$1    [L]</IfModule>

UPDATE

NOTE! In the root of mydomain.com I have a WordPress installation running, so I only need to route users to cake application if there is a vechicles controller name in the URL.

Add this rule in .htaccess before any of wordpress rules.

<IfModule mod_rewrite.c>    RewriteEngine on    RewriteRule    ^vechicles$    cake_app/    [L]    RewriteRule    ^vechicles/(.*) cake_app/$1    [L]</IfModule>

Now mydomain.com/vechicles/ show your cake_app. Inside cake app make routing

CakePHP 2

Router::connect('/add', array('controller' => 'vechicles', 'action' => 'add') );

CakePHP 3

$routes->connect('/add', ['controller' => 'vechicles', 'action' => 'add']);