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.

phalcon tutorial question ->

Hi there

On , they write i have to place a .htaccess file on /:

"Let’s create a couple of rewrite rules in the /.htaccess file:"

...its content should be:


<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ public/    [L]
    RewriteRule  (.*) public/$1 [L]

...BUT: The direcory structure is as follows:


So there can't be the entries RewriteRule ^$ public/ [L] and RewriteRule (.*) public/$1 [L], because there is NO/public folder on webserver root path... the public folider is /tutorial/public on NOT /public

That does match in my opinion...(?)

(Maybe i'm wrong, but i don't think!!)

Thank you for your feedbacks! :-)

With best regards, Jan

I also don't unterstand the 2nd .htaccess rule set, with its header comment /public/.htaccess

There is also NO folder /public, the folder with the "public" directory is on /tutorials/public ...

edited Oct '19

FYI - your post was really hard to read so I modified it. Please take a look - just to see how formatting works.

Those tutorials are ancient. They're for 1.2.0, and the current production release is 3.4 (4.0 soon). I'd recommend looking at updated tutorials:

With that said - the part you're asking about is .htaccess, which I don't think has changed much, if at all. So, with that said...

The rule, very critically is for public/, not /public. Since the .htaccess file lives in /tutorial, a reference to public/ - being a relative reference - points to /tutorial/public. That rule is basically saying "All traffic gets re-routed to public/[whatever was requested].

You'll then have another .htaccess file in public/ that says "if the request isn't for an actual file, route the request to index.php".

The combination of those two .htaccess files results in only files in public/ being able to be accessed directly (ie: css, js, images). Anything else is assumed to be a route, and is passed to index.php for processing and routing.

Hello Dylan

Now it works, thank you very much!

With best regards, Jan