Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run CakePHP in a sub directory appear as the root

I'm trying to keep my root directory clean by not dumping the cake folders in 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's the best way to accomplish this? I've been messing around with the htaccess files for a while, but have not yet resolved the issue. So far I have figured out how to redirect to the subdirectory, but it shows up as www.example.com/cake, when I would like it to just show up as www.example.com.

I'm currently hosted on Media Temple GS, so I dont have access to the apache config files.

Thanks!

like image 933
wcolbert Avatar asked Oct 25 '22 22:10

wcolbert


1 Answers

You should place this into your root directory's .htaccess file

// .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule    ^$ cake/app/webroot/    [L]
RewriteRule    (.*) cake/app/webroot/$1 [L]
</IfModule>
like image 92
Ish Avatar answered Oct 31 '22 09:10

Ish