How to run CakePHP in a subdirectory as root

I'm trying to keep my root directory clean without uploading the cake folders to the directory, but I don't want the URL to be www.example.com/cake. Instead, I need it to be www.example.com

What is the best way to achieve this? I messed around with htaccess files for a while, but haven't solved the problem yet. So far I have figured out how to redirect to a subdirectory, but it displays as www.example.com/cake when I would like it to just display as www.example.com.

I am currently hosted on Media Temple GS, so I do not have access to apache configuration files.

Thank!

+5
source share
2 answers

.htaccess file

// .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule    ^$ cake/app/webroot/    [L]
RewriteRule    (.*) cake/app/webroot/$1 [L]
</IfModule>
+2

app/config routes.php,

<?php

Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'login'));
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

, , ................

+1

All Articles