CakePHP without mod_rewrite causes 404 errors

2019-07-24 08:10发布

问题:

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?

回答1:

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/).