My set of folders looks like this:
server
--public
----index.php
----/items/
------index.php
------template.php
------/folder1/
------/folder2/
------/folder3/
--------index.php
------/folder4/
When this happens, folder3 in the browser shows the content at site.com/items/folder3/.
My task is to display in /folder1/, /folder2/, /folder4/ the content from the file site.com/items/template.php (because these folders do not contain index.php or index.html). How can I do this?
===========================
I tried this way, but it has disadvantages - These rules also work with non-existent directories (as /items/aaa/bbb/zzz/), which is inappropriate for me.
DirectoryIndex index.html index.htm index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1/index\.html !-f
RewriteCond %{DOCUMENT_ROOT}/$1/index\.htm !-f
RewriteCond %{DOCUMENT_ROOT}/$1/index\.php !-f
RewriteRule ^(.+?)(?:/[^/]+)?/?$ template.php [L]