I have public and private projects on my web server. I put everything that is publicly available at the root of the web server, and I have a private folder that I can only use from the local network (.htaccess is installed there).
I just want to put all the private projects in the private folder and process the requests automatically, but I want the URLs to look like they are served using webroot.
For example, if there is private/project1 , I want to use the URL http://example.com/project1 to serve this folder and do not want to change the URL.
This simple rewrite:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ private/$1
works, but when I have private/project2 with another .htaccess :
Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /project2/ <Files .*> Order Deny,Allow Deny From All </Files> # Allow asset folders through RewriteRule ^(assets/.+) - [L] # Protect files from being viewed RewriteRule ^(uploads.+) - [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> Options -Indexes
then static content will appear, but the links will be broken. What should I change for work?
Also, if I have private/project3 and go to http://example.com/project3/ , there is no problem, but when I go to http://example.com/project3 (without trailing /), the url will be Display as http://example.com/private/project3/ in the browser. What for? How can i avoid this?
source share