I have a file structure as follows:
- Site - includes - page.php - pages - example.php - public - .htaccess
.htaccess uses rewrite_module to resolve most requests to page.php.
RewriteRule ^ "../includes/page.php" [L]
page.php parses the original request and includes the proper "page" from the pages directory.
I want initial requests to resolve to /Site/public, so I have the following apache config:
<VirtualHost *:80> ServerName example.com DocumentRoot /Site/public </VirtualHost>
This yields 400 Bad Request errors because I'm attempting to redirect to a file outside of DocumentRoot.
I ultimately don't want a user to be able to directly access files outside of public.
Is there a good way to specify that, in terms of execution, /Site is the root, but in terms of serving /Site/public is the root?