If you are using CakePHP tutorial where you create a blog, you may be this bug when trying to add a post:
Missing Method in PostsController
Error: The action posts is not defined in controller Posts
Controller Error: Create Posts Controller:: users () in file: app / controllers / posts_controller.php.
When this problem occurs we can also see the source code url website that posts the form has twice
/ index.php / post / posts /
/ app / webroot / index.php / post / posts /
The easiest solution to this problem is that when accessing the web do not use index.php:
http://localhost/posts/add
This works correctly, but if someone puts index.php will continue failing. Another solution is to put as DocumentRoot root and edit the file cakephp. Htaccess also the root of cakephp. According to the documentation 3.3.4 Apache and mod_rewrite (and htaccess) must put:
\u0026lt;IfModule mod_rewrite.c>
RewriteEngine on RewriteRule ^ $ app / webroot / [L ]
RewriteRule (.*) app / webroot / $ 1 [L]
\u0026lt;/ IfModule>
This does not work, but if you enter
\u0026lt;IfModule
mod_rewrite.c>
;
RewriteEngine on RewriteRule ^ $ app / webroot / [L]
RewriteRule ^ index \\. /(.*)$ Php app / webroot / $ 1 [L]
RewriteRule (.*) app / webroot / $ 1 [L]
\u0026lt;/ IfModule>
it work both ways:
\u0026lt;IfModule mod_rewrite.c>
RewriteEngine on RewriteRule ^ $ app / webroot / [L ]
RewriteRule (.*) app / webroot / $ 1 [L]
\u0026lt;/ IfModule>
This does not work, but if you enter
\u0026lt;IfModule
mod_rewrite.c>
;
RewriteEngine on RewriteRule ^ $ app / webroot / [L]
RewriteRule ^ index \\. /(.*)$ Php app / webroot / $ 1 [L]
RewriteRule (.*) app / webroot / $ 1 [L]
\u0026lt;/ IfModule>
it work both ways:
http://localhost/index.php/posts/add
http://localhost/posts/add.
0 comments:
Post a Comment