Welcome Guest, Not a member yet? Register   Sign In
404 can't find route
#1

(This post was last modified: 09-14-2023, 02:55 AM by risk.)

Hello,
so in the past I always set up my apache (XAMPP) root directory to point to the public folder of my project. But now I am working on several projects at the same time, so I set my DocumentRoot back to D:/xampp/htdocs/
In my project I set the base url inside the App.php like this: 
PHP Code:
public string $baseURL 'http://localhost/agb/project-root/public/'

Since my projectstructure is the following:
-agb
  -project-root
    -app
    -public
    -tests
    -vendor
    -writable
    -.env
    -builds
    -composer.json
    -composer.lock
    -phpunit.xml.dist
    -preload.php
    -spark

However I always get a 404 error when loading another page, than the homepage. The error message is
Can't find a route for 'get: agb/project-root/public/route'.
route can be replaced by any url I want, it is always the same error.

My routes inside the Routes.php are configured like this:
PHP Code:
$routes->match(['get''post'], 'route/(:any)''Controller::Method/$1');
$routes->get('route''Controller::Method'); 

Where route, Controller and Method are replaced with real Classes and methods.

The thing is: as soon as I add an index.php to my url ( e.g. http://localhost/agb/project-root/public....php/route ) the site is loaded successfully without any errors.

Why do I have this strange error? Could you please help me?
Reply


Messages In This Thread
404 can't find route - by risk - 09-14-2023, 02:52 AM
RE: 404 can't find route - by kenjis - 09-14-2023, 05:54 PM
RE: 404 can't find route - by InsiteFX - 09-14-2023, 08:49 PM
RE: 404 can't find route - by kenjis - 09-14-2023, 10:04 PM
RE: 404 can't find route - by risk - 09-14-2023, 11:42 PM
RE: 404 can't find route - by VerayaTanaysa - 10-16-2023, 11:37 PM
RE: 404 can't find route - by kenjis - 10-17-2023, 01:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB