apache - Display files from another directory with mod_rewrite -
I have transferred all the files from a project that is a single public
directory Should be accessible from outside - so that those directories which are hidden instead of blacklisting, I can be accessible to them.
However, I can not force Apache to rewrite such URLs:
- www.example
-
Lt; Document root & gt; Strong strong> /images/flower.jpg
only rational The solution came with some of those lines:
Rewind Condens Public \ /% {REQUEST_FILENAME} -f # If a file exists in public DIR, then ... RewriteRule * Public / $ 0 [L] #display it
It works surprisingly, <>
I'm totally in disadvantage, do any help Can do?
On the one hand, how do you debug
.htaccess
configuration? I can not fix this problem if I do not know what it is and where it is.
If you want to test for an existing file with -f
, You need to provide a full file system path like this:
RewriteCond% {DOCUMENT_ROOT} / public% {REQUEST_URI} -f rewrite rules! ^ To access public / public% {REQUEST_URI} [L]
otherwise -F
, check through a sub-request:
rewrite public% {REQUEST_URI} -F rewrite rules! ^ Public / Public% {REQUEST_URI} [L]
Comments
Post a Comment