this code (http://bin.cakephp.org/view/172084837) is added to routes.php to connect from "/admin/pages/add" to "/admin/posts/add", but this error is occured: PagesController could not be found.
Enable Admin Area from app/Config/core.php
Routing.prefixes = array('admin', 'manager');
I hope this will work for you.
Related
Can anyone help me to create a custom 404 page in laravel 5.7, i am new to laravel so it'd great if you tell me the flow for this.
Thanks
Create 404.blade.php file in errors folder inside your views and make customizations that you want.
OR
You can also use vendor:publish command to publish all the errors blade defined in core.
php artisan vendor:publish --tag=laravel-errors
This will create an errors folder in your views directory and in it there will be all error blade files. You can customize 404.blade.php in it.
#Kamal's solution is good if you want to use a static 404 file. For more customization you can create a proper 404 controller.
To do so first create a controller and method for handling the 404 page (or add a method to an existing controller). Then, tell Laravel to redirect to that controller if no other route was found by adding this at the end of your routes\web.php file. Here's an example:
Route::get('404', 'PageController#render_404_page');
Route::fallback(function () {
return redirect('404');
});
This gives you the freedom to add more logic to 404 pages.
Before everything was fine, then I added the SSL protocol at my providers cpanel and my site is not working anymore, I get the error:
[Cake\Routing\Exception\MissingControllerException] Controller class Webroot could not be found.
Anyone any idea how to solve this?
I create my first CakePHP application.
My app contains a fixed set of routes. I want redirect to 404 any request that not match to defined routes. I do not want these requests reach controller. I want to redirect its immediately at the Router level.
Since you only want your fixed routes to be used first make sure you remove / comment the require CAKE . 'Config' . DS . 'routes.php'; statement in your app's routes.php to prevent the default routes from being setup. Then with debug off (set debug = 0 in core.php) cake should automatically generate an error page with 404 status for urls not matching a route.
Im currently working on the cakephp tutorial, and have finished the first few steps. I've already added the post model controller(with the action) and view. For some reason though, when I go to www.mysite/posts/index I get a 404 error. I also noticed that the default www.mysite.com
says
Error: PhpController could not be found.
Any suggestions?
/PostsController.php/
<?php
class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}
I also have a PagesController.php in the same directory. I posted it here http://jsfiddle.net/Z3jdu/
?>
i think u can find out by
Regarding pages controller never edit files in /cake/.. Override or extend them.
By default you shouldn't need an index.php, you should enable mod rewrite and allow cake php to read the urls correctly
Try checking your .htaccess and server config to ensure .htaccess can be read.
at the end i should mention this Check your root, app and webroot directories to see if they actually contain a .htaccess file.
Ensure your apache server configuration actually has the following (seeing as it's localhost, allow everything?):
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Ensure the following line is not commented with a hash tag (#)
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Hopefully your app will work and you can start the blog tutorial to learn more
i am a cakephp beginner , have not much exposure to cakephp.
I have followed installation step for Alaxos ACL plugin foe cakephp 2.0 from -alaxos site .. there second step is configuring admin routing .
that i have done by adding
Router::connect('/admin/acl', array('plugin' => 'acl', 'controller' => 'acl', 'action' => 'admin_index', 'admin' => true));
to my Cake/Routing/Router.php file and configuring app/Config/core.php: by adding following line
Configure::write('Routing.prefixes', array('admin'));
i am not sure whether this is the correct way of doing it...
On accessing the plugin http://localhost/cakeacl/admin/acl it gives error
**Private Method in AclController
Error: AclController::admin_index() cannot be accessed directly.**
Please help me ..Thanks in advance...
try to put only the following in the app/Config/core.php and remove the Router configurations.
Configure::write('Routing.prefixes', array('admin'));
Have you tried this guide http://book.cakephp.org/1.3/view/1543/Simple-Acl-controlled-Application from the official site yet?