Is an alternative DocumentRoot possible via Router?
- Nicolas_K
- Member | 25
My actual imagination:
mydomain.tld points on /public (everything already works fine here).
admin.mydomain.tld should point on /admin.
- Is this possible via the RouterFactory (e.g.
$router->addRoute('//admin.mydomain.tld', 'Administration:action');
)? - If yes: would a presenter (here: AdministrationPresenter) be able to handle that alternative DocRoot?
If it is too complicated, then I'll skip it (and use a 2nd or an out-of-nette
system for administration).
If it is possible with few steps / few configuration, then I would
be happy!
Last edited by Nicolas_K (2023-04-19 16:15)
- Nicolas_K
- Member | 25
My intention is a high grade of encapsulation and therefore I wanted to
point to another DocRoot with admin.mydomain.tld .
To have two systems from the outside-view, but one system from
the inside-view.
My belief is, that I can reduce attack-vectors this way on /public (DocRoot
of mydomain.tld) within my scope
(except of a form where I rely on nette security :)
(even not a database in this case)
(as long as .htaccess is well configured).
I know that I can include() or require() php-files from everywhere, but regardless of this I would appreciate to be able to use a Presenter.
Perhaps it's an overtuned/silly idea. If it is too complicated to establish another DocumentRoot within one Nette system, I will handle it centrally. (In any case, admin/ will have a HTTP authentication.)
- materix
- Backer | 83
In “/public” for the host “mydomain.tld” you have “index.php” and “.htaccess” which boots up your application, which is located outside of the “public”-folder, e.g. a folder named “/app”.
You can setup another virtual host on your webserver to use another public folder, e.g. “/admin” for “admin.mydomain.tld”. In this folder, you can also have an “index.php” and “.htaccess” that boots up the same application as “mydomain.tld”, where it uses the “admin”-route and therefore dispatches the admin-presenter.
Last edited by materix (2023-04-20 21:13)