following this and i still get this error:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
following this and i still get this error:
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Here is how I made it sing:
root folder in apache24/htdocs/ accessible as localhost/
slim in localhost/vendor
project in localhost/
.htaccess in root folder (localhost/)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
<?php
use Slim\Factory\AppFactory;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
require __DIR__ . '/vendor/autoload.php';
$app = AppFactory::create();
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write('Hello world!');
return $response;
});
$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
$name=$args['name'];
$response->getBody()->write("Hello $name!");
return $response;
});
$app->run();
If I move .htaccess and index.php to a public folder located in my web root, then the index.php should be like this:
<?php
use Slim\Factory\AppFactory;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
require __DIR__ . '/../vendor/autoload.php'; <====== CHANGE HERE
$app = AppFactory::create();
$app->setBasePath("/public"); <====== CHANGE HERE
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write('Hello world!');
return $response;
});
$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
$name=$args['name'];
$response->getBody()->write("Hello $name!");
return $response;
});
$app->run();
I had similar errors to those mentioned by others and the problem was that although the mod_rewrite module of Apache was enabled, it was not working because the AllowOverride setting in httpd.conf of Apache is set to None by default. You should leave this to None for the global setting (for security - as suggested), but you should change it to âAllowOverride Allâ for the virtual host you are working with (that is: <Directory â${SRVROOT}/htdocsâ> for the default localhost).
This is stated in the documentation here:
The above should work with any virtual host defined in Apache.
Thanks for this. 
It helped, but now i get error - Method not allowed.