We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Set exception in sending all URIs to public directory

I know this looks a bit childish, but I have this problem, that I have another folder inside my phalcon project folder and when I try ro access it, it sends me to the 404 page of phalcon, This is my folder structure, and I want to go to the folder "api" directly,

I know the problem is with the htaccess file and these lines:

RewriteRule ^$ public/ [L]

RewriteRule (.*) public/$1 [L]

but I don't know how to put an exception to that folder, any help, I'll be very thankfull.



5.3k
Accepted
answer

The root of the web server should direct to the public folder. The only rewrite rule that is required is to direct all urls to the public/index.php, since all the urls are handled by Phalcon, through the router configuration. What I would suggest is setting up the api folder as a subdomain, and then you can implement your own API or use Phalcon. But, since you still want to be able to go to the api directory, you're going to have to put the api folder in the public folder.