klein / klein.php

A fast & flexible router
MIT License
2.67k stars 289 forks source link

Second Subdirectory Routing Not Working #410

Open MASRPNathan-G opened 3 years ago

MASRPNathan-G commented 3 years ago

I've successfully set up Klein in subdomain of my site cad.website.xyz/path/to/routing/. In there I have my .htaccess file which contains the following:

Options -MultiViews

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Along with the following PHP script at the top of my index.php:

$base  = dirname($_SERVER['PHP_SELF']);
if(ltrim($base, '/')){$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], strlen($base));}

This config works for that portion of my site. Using the same .htaccess config with the PHP script atop my index file allows Klein to work with the respond all response, but anything else throws a 404 error. I'm not sure if it would matter much but I've tried removing the existing .htaccess file from the initial subdomain to see if it was conflicting with the one I'm attempting to set up, but it didn't change anything.

Any ideas?