All,
I have worked with Apache for well over a decade now and have come to
understand that there is usually more than one way to accomplish desired
outcomes. I have been trying for a couple of weeks to troubleshoot
something that I thought at first would be
a simple conf error or mis-use of a module/context but I am starting to
wonder if I am trying to get apache to do something it not able to handle.
If you would, please give the following a read and let me know what you
think.
In short, I am trying get Location directives in my vhost conf to
match after using mod_rewrite in my .htaccess file.
I have the following in .htaccess:
# pass through non-matched files (e.g., anything but assets) to
codeigniter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
And, in a vhost conf I have the following:
# cache /virtualpath/ content for 30 days
<Location /virtualpath/>
ExpiresActive On
ExpiresDefault "access plus 30 days"
Header Set Pragma "public"
Header Set Cache-Control "public"
</Location>
# cache /realpath/ content for 15 days
<Location /realpath/>
ExpiresActive On
ExpiresDefault "access plus 15 days"
Header Set Pragma "public"
Header Set Cache-Control "public"
</Location>
I have found that real paths (physical files on the file system) get
the headers added while virtual files paths (those processed by
codeigniter) do not. This has stumped me for days. I believe this is
because the path env var is rewritten when the htacess
rewrite rule kicks in. A recent day of googling uncovered this very
informative writeup:
http://stackoverflow.com/a/10128290/171475.
>From that writeup, I am guessing there is no way to use a Location
match on the original request path. Would you agree or is there another
creative way you would suggest trying to solve the conflict between the
rewrite and the Location directive?
Any pointers or help you can provide would be greatly appreciated.