How to run CakePHP in a sub directory appear as the root
I'm trying to keep my roo开发者_如何转开发t 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!
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>
There is routes.php file in app/config folder open it and it will look like
<?php
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'login'));
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
you just need to change the word login to any view file you want to load first when you open your site and its done................
精彩评论