I have the following structure:
/home/
alvaro/
public_html/
Code Playground/
SlimTest/
logs/
public/
src/
templates/
vendor/
...
http://example.com
points to /home/alvaro/public_html
, thus http://example.com/Code Playground/SlimTest
points to /home/alvaro/public_html/Code Playground/SlimTest
, directory on which I've placed this .htaccess
file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
In short, loading http://example.com/Code Playground/SlimTest
in the browser executes my /home/alvaro/public_html/Code Playground/SlimTest/public/index.php
Slim/3.9.0 (slim/slim-skeleton) entry point.
My problem is that I can't get routes right. I've tried every conceivable combination:
$app->get('/Code Playground/SlimTest', …);
$app->get('/Code Playground/SlimTest/', …);
$app->get('/Code Playground/SlimTest/public', …);
$app->get('/', …);
// …
... but I always get the 404 Not Found page delivered by Slim's NotFound
class.
Is there a way to get base path upon route definition so I can prepend it in
get()
?If not, what would a hard-coded path look like?
Should I look for a fix in Apache, such as Alias?