Suppose my site - example.com had a subdomain - subdomain.example.com which I have deleted.

How do I redirect the not found error in PHP or the mod_rewrite (.htaccess)?

  • 1
    You have to have the sub-domain defined. When a request comes to your web-server it needs to know how to handle it. Otherwise it would be ignored completely and there will be no opportunity to redirect it. You will need to set-up a CNAME and define it on your websever. Then you can redirect your sub-domain to where ever you want to.
    – closetnoc
    Sep 13, 2015 at 14:28


Browse other questions tagged or ask your own question.