Welcome Guest, Not a member yet? Register   Sign In
Route doesnt work on server
#1

(This post was last modified: 07-24-2023, 04:14 AM by pippuccio76.)

hi i have thi route :

Code:
$routes->group('users', ['filter' => 'usersFiltersNoAuth'], function($routes) {

$routes->add('login', 'User::login');
$routes->add('register', 'User::registrazione');
$routes->add('reset_pw', 'User::reset_pw');

});

When i insert on browser my_site/users/register or my_site/users/login it works but if i insert my_Site/users/reset_pw i have :

Code:
Can't find a route for 'get: users/reset_pw'.

on localhost it work . Why ?
Reply
#2

It is recommended to use verbs https://codeigniter.com/user_guide/incom...erb-routes route than add
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#3

It's recommended not to use add, but to use the http verbs get / post etc;
.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Work with match. thank you
Reply
#5

(This post was last modified: 08-12-2023, 10:13 AM by pippuccio76.)

another problem :

Code:
$routes->group('admin', ['filter' => 'adminFiltersAuth'], function($routes) {
   $routes->match(['get','post'],'changeEmail', 'Admin::changeEmail');
   $routes->match(['get','post'],'changePassword', 'Admin::changePassword');
   $routes->get('logout', 'Admin::logout');
   $routes->get('test', 'Admin::test');
   $routes->get('index', 'Admin::index');
   $routes->get('', 'Admin::index');

});
my link :
https://mysite/aggregatore_viaggi/index.php/admin/test
Code:
Can't find a route for 'get: admin/test'

admin/login working fine...

why ?
Reply
#6

See output in terminal

Code:
$ php spark routes
Simple CI 4 project for beginners codeigniter-expenses
Reply
#7

(08-12-2023, 12:45 PM)ozornick Wrote: See output in terminal

Code:
$ php spark routes

In server i cannot use terminal...
In localhost It work fine...
Reply
#8

Try something like this:

PHP Code:
<?php

namespace App\Controllers;

class 
Home extends BaseController
{
    public function index(): string
    
{
        return '<pre>' command('routes');
    }

Reply




Theme © iAndrew 2016 - Forum software by © MyBB