CakePHP没有mod_rewrite会导致404错误 [英] CakePHP without mod_rewrite causes 404 errors

查看:198
本文介绍了CakePHP没有mod_rewrite会导致404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆