Is an alternative DocumentRoot possible via Router?

Nicolas_K
Member | 25
+
0
-

My actual imagination:
mydomain.tld points on /public (everything already works fine here).
admin.mydomain.tld should point on /admin.

  1. Is this possible via the RouterFactory (e.g. $router->addRoute('//admin.mydomain.tld', 'Administration:action');)?
  2. 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)

materix
Member | 70
+
0
-

Are there some other non-Nette files located in “/admin”, that you wish to execute instead of a Nette Presenter?

Nicolas_K
Member | 25
+
0
-

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
Member | 70
+
+3
-

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)

Nicolas_K
Member | 25
+
+2
-

That works!!
So simple!!
I didn't see the forest for the trees…! (german proverb)
(„Neviděl jsem les pro stromy“..)
Many thanks – and sorry for the inconvenience!

Last edited by Nicolas_K (2023-04-20 20:21)