page not found when opening my index.php with wamp

0

I'm trying to make an api in php however, when trying to access any endpoint the browser tells me:

  

The page you are looking for could not be found. Check the address bar   to ensure your URL is spelled correctly. If all else fails, you can   visit our home page at the link below.

The same thing happens when I try to open the index.php. the only page that loads me correctly is the localhost by default of wamp, I have verified all the creation of the virtualhost thinking that this may be the problem however it still does not work.

I used the slim framework and the wamp tool itself to create the virtual host

httpd-vhosts.conf file:

<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>


<VirtualHost *:80>
    ServerName site
    DocumentRoot "c:/wamp64/www/slim1/public"
    <Directory  "c:/wamp64/www/slim1/public/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>



<VirtualHost *:80>
    ServerName apiexample
    DocumentRoot "c:/wamp64/www/apiexample/public"
    <Directory  "c:/wamp64/www/apiexample/public/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

host file:

127.0.0.1 localhost
127.0.0.1 site

::1 localhost
::1 site

127.0.0.1   apiexample
::1 apiexample

index.php:

<?php

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require '../vendor/autoload.php';
require '../src/config/db.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");

    return $response;
});

//Crear las rutas para el cliente
require "../src/routes/usuarios.php";
$app->run();

?>

.htaccess

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

<IfModule mod_rewrite.c>
  Header add Access-Control-Allow-Origin: "http://localhost:4200/"
  Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
  Header add Access-Control-Allow-Headers: "Content-Type"
  RewriteEngine on
  RewriteBase /
</IfModule>
    
asked by Alan Palacios 12.07.2018 в 20:01
source

0 answers