Closed karamusluk closed 6 years ago
Please help me @Rican7
I've never been very good at Apache config stuff, but that looks reasonable.
As far I can tell, that should work, but it is slightly different from the Apache config examples I found when I looked around: https://github.com/klein/klein.php/wiki/Sub-Directory-Installation https://stackoverflow.com/questions/47122069/klein-php-router-cant-get-it-to-work https://gist.github.com/jamesvl/910325/6e582ff3cc4276ad57bc3fcf28a17e8c975ff246
As I said, what you have looks like it should work, in my non-expert opinion, but it's worth comparing to these examples, and seeing if the differences are significant.
Now, once you have you rewrite stuff in place, all requests are going to be redirected to index.php. So index.php needs to be ready to receive them. The simplest example of that comes from the README for the project, near the top:
<?php
require_once __DIR__ . '/vendor/autoload.php';
$klein = new \Klein\Klein();
$klein->respond('GET', '/hello-world', function () {
return 'Hello World!';
});
$klein->dispatch();
Of course, that only defines a route for "/hello-world". Any request to any other route will give a 404. So you would need to specify each route you want to match, in similar manner to above (see the docs for more variations on specifying routes).
If you've already done that, maybe you should post your index.php, or the file included by your index.php that has your routing logic, basically the lines of code that call \Klein\Klein::respond()
like what I listed above. There could be an error there.
You mentioned "subroutes" in your ticket. It occurs to me you may be trying to something with: https://github.com/klein/klein.php#route-namespaces
which allows you to group routes. I have not used this feature much, and when I did (several years ago), it gave me some trouble. It wasn't broken, it just didn't do what I hoped it would in the that I hoped. I can't remember the details.
Anyway, if you're working with that feature, and it's giving you trouble, I would advise refactoring to remove it, at least temporarily. If you're able to get things working without the feature, that might be a satisfactory solution long term. On the other hand, if you really need the grouping functionality, you will at least have a clearer understanding of the problem to be solved.
Actually thank you very much for your respond @eimajenthat
error was on my htaacess. As much as it is comic i have only one line in my htaccess and whole system is working like a charm.
FallbackResource /index.php
Thank you again
If it ain't broke, don't fix it!
Best of luck in your continued Klein routing adventures.
I was going to mark this ticket closed, but I can't find a button to do so. I might not have sufficient access privileges on this project. Maybe as the original ticket author, you can mark it closed?
Hi everyone, I am having trouble about subrouting as follows; when i try to acces that file it gives me not found error.
or even when i try to access
This is my htaccess file
Also i am not sure how to configure klein.php inside the pure php.
Can anyone help me to figure the problem out ? Thanks.