Checking if file exist with RewriteCond in a chained RewriteRule

Posted by gelilloabad on Stack Overflow See other posts from Stack Overflow or by gelilloabad
Published on 2010-04-19T16:40:44Z Indexed on 2010/04/19 16:43 UTC
Read the original article Hit count: 309

Filed under:
|
|

Hello, I hope you could help me here.

I have a RewriteRule which gives you a crossdomain.xml file depending on the domain name. I have it in a way that ignores the ".dev." string in the middle, example:

Request: http://site1.dev.mydomain.com/crossdomain.xml
Returns file: /etc/httpd/conf/crossdomain/site.mydomain.com.xml

RewriteCond %{HTTP_HOST} "^(.*)\.dev\.(.*)"
RewriteCond %{REQUEST_URI} "/crossdomain.xml"
    enter code hereRewriteRule ^(.+) %{HTTP_HOST}$1 [C]
    RewriteRule ^(.*)\.dev\.([^/]*)/crossdomain.xml /etc/httpd/conf/crossdomain/$1.$2.xml [L]

Question: How do I check if the file exists? I tried adding this on top but it doesn't work:

RewriteCond  /etc/httpd/conf/crossdomain/$1.$2.xml  -f

I guess because it is a chained rule, no idea. Please help.

© Stack Overflow or respective owner

Related posts about mod-rewrite

Related posts about apache2