Reputation: 12923
I am having issues with getting Slim to recognize the following:
$app = new \Slim\Slim();
$app->get('/', function () {
echo "Hello";
});
$app->get('/:name', function () {
echo "Hello";
});
$app->run();
It will see the first route just fine, how ever the second one returns a
Not Found
The requested URL /image-uploader/gg was not found on this server.
Which lead me to believe I didnt have the re-write mod enabled in wamp. So I enabled it and set AllowOverride
to All
I then restarted wamp and visited localhost/image-uploader/
and I get Hello
, how ever visiting the second route gives the error above.
Why? My htaccess is as such:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule index.php [L]
</IfModule>
Upvotes: 2
Views: 634
Reputation: 19016
Since your project is not in root folder but in image-uploader
folder, your path is not correct.
You can change RewriteBase
as follow (assuming your htaccess is in image-uploader
folder)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /image-uploader/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
Now, it should be working as expected. Actually, i don't know much more about SlimPHP but it looks like it's fine
Upvotes: 2