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.

.htaccess Settings

I have a Phalcn site for which I am setting up three entry points.

/.htaccess
/index.php
/public
/dashboard
/api

The idea being that apache .htaccess handles sending all requests to /public via the following:

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

I would like to account for the dashboard and api directories similarly...without clobbering the /public settings...

Is there any boilerplate .htaccess for this?

Many thanks!!

I would just send everything to index.php as normal and employ Phalcon's routing to acheive the desired results.

http://docs.phalconphp.com/en/latest/reference/routing.html

I see what you are saying...for the API urls that will work. I think the dashboard urls is the real trick right now. I wanted to keep it on the same directory level as the public folder in order to avoid nesting it under public.

You may then want to consider using modules with namespaces http://docs.phalconphp.com/en/latest/reference/applications.html#multi-module in your case.

Your structure could then be something like:

app/
    components/
    config/
        config.php
        ...
        ...
        routes.php << Look at the links example but you will be setting routes for each module and declaring defaults
    lib/
    models/
    modules/
        dashboard/
            controllers/
            views/
            Module.php
        api/
            controllers/
            views/
            Module.php   << This is where the magic happens see the link
public/
vendor/

Thanks Andy, that is very close to what I have. I guess if I were to say the question a different way...

Where would the most likely place be for ex a bower_components directory, CSS dir. etc...

I have all of this under /public for the public facing UI...but wanted to avoid the /dashboard under public...

What does "Dashboard" contain?

edited May '15

It would contain a bootstrap/Angular admin area template that I will wire up to Phalcon. So, images/css/JS. The HTML would go in a layouts folder for each module...so ex: dashboard.phtml would be under /apps/modules/backend/layouts/ and populated with views under the backend area



2.2k
Accepted
answer

Final resolution: exclude the dashboard directory by using this rewrite rule before all others:

RewriteRule ^(dashboard)($|/) - [L]