# Problem with Routes - Page Not Found

**URL:** <https://discourse.slimframework.com/t/problem-with-routes-page-not-found/2468>\
**Category:** Questions\
**Created:** [June 12, 2018, 1:37am UTC](https://discourse.slimframework.com/t/problem-with-routes-page-not-found/2468 "2018-06-12T01:37:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![schimmlpfeng](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@schimmlpfeng](https://discourse.slimframework.com/u/schimmlpfeng)\
**Post date:** [June 12, 2018, 1:37am UTC](https://discourse.slimframework.com/t/problem-with-routes-page-not-found/2468/1 "2018-06-12T01:37:57Z")

</div>

Hi,  
I’m trying to create a web service here using Slim3 with PHP and mySQL. When I try to connect to this web service ([http://webservice.test/v1/test](http://webservice.test/v1/test) ), the browser and my postman return “Page not Found”  
I’m t

Here is my index.php

```
$app->get('/teste', function (Response $response) use ($app) {
$response->getBody()->write("Test here");
return $response; });

$app->post('/createuser' , function () use ($app) {
verifyRequiredParams(array('first_name', 'last_name', 'username', 'password'));
$response = array();
$first_name = $app->request->post('first_name');
$last_name = $app->request->post('last_name');
$username = $app->request->post('username');
$password = $app->request->post('password');
$db = new DbOperation();
$res = $db->createUser($first_name, $last_name, $username, $password);
if($res == 0) {
    $response["error"] = false;
    $response["message"] = "User created";
    echoResponse(201, $response);
} else if($res == 1) {
    $response["error"] = true;
    $response["message"] = "Oops, error while creating a user";
    echoResponse(200, $response);
} else if($res == 2) {
    $response["error"] = true;
    $response["message"] = "E-mail already exist";
    echoResponse(200, $response);
} });

```

And here is my .htaccess

```
RewriteEngine On 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d 
RewriteRule ^ index.php [QSA,L]

```

I’m trying to create a web service here using Slim3 with PHP and mySQL. When I try to connect to this web service, the browser and my postman return “Page not Found”

Here is my index.php

$app-\>get(’/teste’, function (Response $response) use ($app) {  
$response-\>getBody()-\>write(“Fuck off”);  
return $response; });

$app-\>post(’/createuser’ , function () use ($app) {  
verifyRequiredParams(array(‘first\_name’, ‘last\_name’, ‘username’, ‘password’));  
$response = array();  
$first\_name = $app-\>request-\>post(‘first\_name’);  
$last\_name = $app-\>request-\>post(‘last\_name’);  
$username = $app-\>request-\>post(‘username’);  
$password = $app-\>request-\>post(‘password’);  
$db = new DbOperation();  
$res = $db-\>createUser($first\_name, $last\_name, $username, $password);  
if($res == 0) {  
$response[“error”] = false;  
$response[“message”] = “User created”;  
echoResponse(201, $response);  
} else if($res == 1) {  
$response[“error”] = true;  
$response[“message”] = “Oops, error while creating a user”;  
echoResponse(200, $response);  
} else if($res == 2) {  
$response[“error”] = true;  
$response[“message”] = “E-mail already exist”;  
echoResponse(200, $response);  
} });  
Here is my .htaccess

RewriteEngine On  
RewriteCond %{DOCUMENT\_ROOT}%{REQUEST\_FILENAME} !-f  
RewriteCond %{DOCUMENT\_ROOT}%{REQUEST\_FILENAME} !-d  
RewriteRule ^ index.php [QSA,L]

I know the problem is not the apache because I created a php file inside the directory and works fine.

Can anyone helps me?

Thanks

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [June 12, 2018, 7:54am UTC](https://discourse.slimframework.com/t/problem-with-routes-page-not-found/2468/2 "2018-06-12T07:54:51Z")

</div>

Your route is `/teste` but you are testing against: `/v1/test`.

> [@schimmlpfeng](#):
>
> $app-\>get(’/teste’,

Try to change the route to this:

```php
$app->get('/v1/test', ...

```

---

<div class="post-metadata">

**Author:** ![schimmlpfeng](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@schimmlpfeng](https://discourse.slimframework.com/u/schimmlpfeng)\
**Post date:** [June 12, 2018, 8:46pm UTC](https://discourse.slimframework.com/t/problem-with-routes-page-not-found/2468/3 "2018-06-12T20:46:38Z")

</div>

Thanks for your reply odan .  
I made the change and still the same problem.
