If a request comes to my server which action is taken first DNS or Apache? Let's say my domain is domain.tld and I am using ISPConfig2 In the DNS section of ISPconfig I have domain.tld and www.domain.tld pointing to the IP address of my server. Also, in DNS I have red.domain.tld but it points to the IP on a different server. I have a 301 redirect setup in ISP Manager for domain.tld so that all non-www requests will be permanently redirected to www.domain.tld. I did that by placing the following into "Apache Directives (Optional):" in ISPConfig. Will requests for red.domain.tld be directed to the IP on the different server or will Apache convert all requests for red.domain.tld to www.domain.tld? I would assume that dns would reroute the requests before Apache ever sees them but, I'm not sure.
DNS comes first, but your dns server is not queried for every request. So it may take up to 48 hours unteil a chnage in dns is recognized by all dns caches.