Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to test for and serve a particular file if I find it anywhere in the request, and if I don't find it move on to the rest of the rules. I can't get it to consistently do this.

RewriteRule ^/ /var/www/html/index.html [NC,L]

share|improve this question
Can you clarify what you mean? Are you looking to act on requests sent to, or ones with as part of the file or directory structure in the request? –  Shane Madden Sep 14 '11 at 22:09

1 Answer 1

The ^ means start of line/string, so requests to and should match, but would not match. Try removing the ^ and prefix the . with a \ so that it matches a . and not any char use

RewriteRule test\.com /var/www/html/index.html [NC,L] was used as a reference.

share|improve this answer
Thanks for your response, it's very helpful. I'm still having an issue with vs I would think the folliowing would match either, but it doesn't seem to be the case: RewriteRule test\.com /var/www/html/index.html [NC,L] –  d_b_g Sep 15 '11 at 14:12
I would think it would work too. Does work, but not –  becomingwisest Sep 15 '11 at 18:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.