CakePHP没有mod_rewrite会导致404错误 [英] CakePHP without mod_rewrite causes 404 errors
问题描述
我在CakeroP上安装了CakePHP 2.3.8。
配置SQL并删除所有3个.htaccess文件,因为我没有mod_rewrite。在core.php中我激活
配置:: write('App.baseUrl',env('SCRIPT_NAME'));
我创建了Posts-Model,Controller和索引 - View就像教程所说。
APP / View / Pages / home.ctp告诉我,
$ b
但是当我尝试打开/ posts / index时,我得到一个404。为什么?
没有mod_rewrite的urls看起来像 www.example.com/index.php/controllername/actionname/param
,即在你的例子中必须调用 /index.php/posts/index
(或 /index.php/posts /
)。 p>
I'm pretty new to Cake, so I tryed to start with the blog tutorial.
I installed CakePHP 2.3.8 in webroot. Configured SQL and deleted all 3 .htaccess-files, cause i have no mod_rewrite. In core.php I activated Configure::write('App.baseUrl', env('SCRIPT_NAME')); I created the Posts-Model, Controller and the index-View like the tutorial says.
The APP/View/Pages/home.ctp tells me, everything's allright.
But when i try to open /posts/index i get a 404. Why?
Without mod_rewrite the urls look like www.example.com/index.php/controllername/actionname/param
, i.e. in your example you have to call /index.php/posts/index
(or /index.php/posts/
).
这篇关于CakePHP没有mod_rewrite会导致404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!