Hello,
I read a lot of discussions about routing but I couldn't find someone with the same problem I'm facing.
We have routes poiting to autogenerated apidoc, which goes to public/apidoc/ (with index.html, css folder, img folder etc)
in Bootstrap, I declared the route like this :
$router->add(
"/apidoc",
[
'namespace' => "Project\\Index\\Controllers",
'module' => 'index',
'controller' => 'index',
'action' => 'apidoc'
]
);
and in my action :
/**
* Action to render the view of the auto-generated doc page
* @param string $folder
*/
public function apidocAction () : void
{
$this->view->setViewsDir(PUBLIC_PATH . '/apidoc');
}
If I want to access the page, it works with https://www.mywebsite.fr/apidoc/
But if I write down https://www.mywebsite.fr/apidoc, the url is rewritten like this :
It works, the doc is displayed but the url is ugly and not convenient...
I tried modifying htaccess in all ways and I'm out of ideas.
The htaccess files are like this :
public/.htaccess
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
Thanks for the help, I've been using Phalcon for 3 years now and I never faced the problem before, maybe the way we point public files with setViewsDir is wrong, I'm open to other solutions of course.