I want to test for test.com 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 ^/test.com /var/www/html/index.html [NC,L]
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
The ^ means start of line/string, so requests to http://example.com/test.com and https://www.example.com/test.com_with_more should match, but http://example.com/in_front_test.com 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]
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule was used as a reference.