Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How does htrouter work?

The basic tutorial says that you need to put .htrouter.php to the root of your project, also giving the posibility of not using .htacces or configure whichever web server you are using. But I've been trying to make it work without .htaccess or configuring apache, and it doesn't. So what is really the functionality of this file?

I leave it at project's root, so if my project is called work, inside this you can see app folder, public folder and .htrouter.php, and I turn on apache, then go to firefox and enter

http://localhost/phalcon/work/

It will only show the listing of folder and files, unless they have a dot at the beginning of its name. When created with phalcon-devtools, if i remove the .htaccess file, it will not work showing the content of the index.html, that says:

Mod-Rewrite is not enabled Please enable rewrite module on your web server to continue

So, what is this all about? Is the tutorial out of date? Am I missing something here? Somekind of configuration to make the .htrouter.php file work?

Thanks fo help



49.2k
Accepted
answer

In the examples, .htrouter.php is only used when running PHP's built-in webserver. Apache has no mechanism to use that file.

https://github.com/phalcon/tutorial/blob/master/.htrouter.php

https://docs.phalconphp.com/en/latest/webserver-setup#php-built-in

Oh, nice, thank you, I was reading it without going into the side articles. Now I really get it. I had to read a bit more, but you helped me understand it better. I will try to keep up with every single related article so I can manage my way around this framework!

edited 19d ago

Oh, nice, thank you, I was reading it without going into the side articles. Now I really get it. I had to read a bit more, but you helped me understand it better. I will try to keep up with every single related article so I can manage my way around this framework!

It's fine to ask questions here, the docs can be overwhelming in one sit ;]