Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always page not found if not root #3

Closed
manaka02 opened this issue Dec 10, 2019 · 1 comment
Closed

Always page not found if not root #3

manaka02 opened this issue Dec 10, 2019 · 1 comment

Comments

@manaka02
Copy link

manaka02 commented Dec 10, 2019

Hello, first thanks for this great extension,
I'm trying it and it works perfect when I do for the root page (mydomain.com) but when I want to do for example login URI, I always have 404 not found.
Here what I do :

`require "./vendor/autoload.php";

// Require the main WaterPipe class
use ElementaryFramework\WaterPipe\HTTP\Request\Request;
// Require the Request class
use ElementaryFramework\WaterPipe\HTTP\Response\Response;
// Require the Response class
use ElementaryFramework\WaterPipe\WaterPipe;

// Create the base pipe
$basePipe = new WaterPipe;

$basePipe->request("/", function (Request $req, Response $res) {
$res->sendText("Welcome to my dark world"); work perfectly
});
$basePipe->post("/game", function (Request $req, Response $res) {
$res->sendText("Welcome to my dark world 2"); //didn't work
});

// $basePipe->get("/api/exchange_rate", function (Request $req, Response $res) {
// $controller = new Rate_Controller();
// $controller->exchange_rate($req, $res);
// });
// Run the pipe and serve the API
$basePipe->run();
`
When I call mydomain.com/game, I always had 404 not found. And now I think it is normal cause I dont have file named game and I didn't touch .htaccess.

Or I'm in wrong way.

Hope you can help me, thanks

@manaka02
Copy link
Author

I found the solution,
Add a redirect in .htaccess file to the index.php
Like this :

RewriteEngine On # Activer le module Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]

@na2axl na2axl pinned this issue Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant