简体   繁体   中英

How do I fix default CakePHP routing on a “baked” MVC?

I just set up a database according to CakePHP's conventions, ran the "bake" scripts for models, controllers and views, and made sure the path was set up correctly.

When I go to the following style of URL:

http://BASEURL/app/controller_name 

I get the expected list view for that controller, but all the links generated by baked pages are in the format I expect to see:

http://BASEURL/controller_name

which gives me a 404. Interestingly enough, this:

http://BASEURL/app/

gives me:

Missing Method in AppController
Error: The action index is not defined in controller AppController
Error: Create AppController::index() in file: app/controllers/app_controller.php.

but this:

http://BASEURL/

gives me the default index page.

Here's my .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>

Everything else is just as created by default and the bake scripts. Can anyone help point me in the right direction?

Please let me know if there's ANYTHING I can clarify or show an example of.

Looks like this guy had a similar problem, and the solution was in making the base directory something other than app.

http://groups.google.com/group/cake-php/msg/5fba6c41a505ed48?pli=1

确保您的虚拟主机或doc根目录指向应用程序文件夹,而不是其父文件夹。

I just had have the same problem of danieltalsky , i fix it with this response:

............... " I've gotten the same problem when I put the entire application into a directory that contain the words:

"app"

or

"cake"

If your directory's real name is "myapp" try changing it for "mysoftware" and reload again, there is no necessary to alter .htaccess files.

............... "

it's from https://groups.google.com/forum/#!msg/cake-php/AqLkqcztdHE/SO0FpUFsul8J .

Lucky

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM