Welcome Guest, Not a member yet? Register   Sign In
Routing not working for a particular Name.
#1

(This post was last modified: 01-29-2023, 11:13 AM by MonkFox.)

I'm using CI v4.2.4.
I'm using PHP Tools For Visual Studio 2019 by DevSense.
I'm running the project locally with the PHP server installed and used by the PHP Tools.
I don't think the built-in server uses .htaccess, so I'm fairly certain that's not it.

I have a Controller named Project.

PHP Code:
<?php
namespace App\Controllers;

class 
Project extends BaseController {

    public function all(){

        $constructionProjects $this->repoService->ProjRepository->retrieve_all_top1images(7);
        $designProjects      $this->repoService->ProjRepository->retrieve_all_top1images(5);
        $planProjects        $this->repoService->ProjRepository->retrieve_all_top1images(8);

        $this->mergeHeader([
            "constructionProjects" => $constructionProjects,
            "designProjects"      => $designProjects,
            "planProjects"        => $planProjects
        
]);

        return view("areas/project/project_all"$this->headerData);
    }




I have a GET route added:
PHP Code:
$routes->get("/Projects""Project::all"); 


For some reason this is the only route that gives me a 'Not Found' response stating, "The requested resource /Projects was not found on this server."
If I change the URL to localhost:23279/index.php/Projects it works just fine.

If I try any other route that isn't defined (localhost:23279/blah, for example), I get the '404 - File Not Found' response stating, "Can't find a route for 'get: blah'.".

However, if I add the route for '/blah' to 'Project::all', and navigate to localhost:23279/blah, then it works.

Are there particular routes that are keywords or protected in some way?  

Thanks,
Justin
Reply
#2

(01-29-2023, 10:03 AM)MonkFox Wrote: For some reason this is the only route that gives me a 'Not Found' response stating, "The requested resource /Projects was not found on this server."
If I change the URL to localhost:23279/index.php/Projects it works just fine.

The error message comes from Apache, not CodeIgniter.
That is the request is not yet routed to CodeIgniter.

There is something wrong with your Apache configuration,
not in CI's routing configuration.

See https://codeigniter4.github.io/CodeIgnit...ith-apache
Reply




Theme © iAndrew 2016 - Forum software by © MyBB