Wednesday, August 22, 2018

apache 2.2 - mod_rewrite rules for non-default page cache directory for Rails application with distinction between mobile directory and www directory

My Question is similar (almost the same) to another question asked here: but with a twist.




Does anybody have some working Apache mod_rewrite rules that enable
Phusion Passenger (mod_rails) to use a non-default location for the
page cache within a Rails application? I'd like the cached files to go
in /public/cache rather than the default of /public.





In my case I have 2 custom directories. "/public/www.MYSITE.com/" and "/public/m.MYSITE.com" for mobile requests.



This particular mod_rewrite code works for me ONLY for www.MYSITE.com requests:



RewriteRule ^$ /www.MYSITE.com/index.html [QSA]
RewriteRule ^([^.]+)$ /www.MYSITE.com/$1.html [QSA]


Now is there a way to take the www.MYSITE.com or m.MYSITE.com from the incoming url and substitute it for the directory location to look for the cached page? Everything about the url for both mobile and www requests are the same except for the prefix of the host "m" for mobile browsers and "www" for everything else.




Just to clarify I have mod_rewrite conditions/rules to detect mobile browser which works fine I just need to tell apache which cache directory it is located in based on the subdomain of the request.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...