开发者

Cakephp htaccess

I am new with cakephp and i have some dificul开发者_运维百科ties...

What I am trying to make is to load the index of the site with a url like:

http://mydomain/aboutus

If I not use cake i would as folowing:

RewriteRule ^aboutus$ index.php [L,QSA]

but how to do with cake? :)

Thanks


These 'redirections' are handled by CakePHP. You should use Routes in order to program 'redirecting'. Keep in mind the following default line at /app/config/routes.php Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));

You probably want something like Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'aboutus'));


Check out following section in CakePHP's book: Apache and mod_rewrite (and .htaccess)


In the router.php

Router::connect('/', array('controller' => 'YOURCONTOLLERNAME', 'action' => 'WHERE U WANT TO REDIRECT'));

Router::connect('/', array('controller' => 'users', 'action' => 'index'));

i hope that helps.


Change routes.php where you want to redirect :

Router::connect('/cruize',array('controller' => 'Users', 'action' => 'cruizer','cruize' =>true));

OR

you can change .htaccess file according you.

RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] php_value post_max_size 500M php_value upload_max_filesize 500M php_value memory_limit 10024M php_value max_execution_time 15000 php_value max_input_time 1500

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜