By default Virtualmin locks out and replaces the entire disabled site with a “virtualmin here; this site has been …. (whatever you have entered as disable reason)” page.
But it serves this page with a 200 OK status code to all visitors, which can be problematic if whatever content was on that site is depended on elsewhere and that elsewhere checks this status code.
Normally, a site that is no longer functional (being moved, disabled or otherwise) should return a clear non-working code. There are many status codes to choose from, but for the old disabled copy of a moved site that is reached incorrectly (perhaps due to stale DNS cache) I think either code 410 (Gone) or 421 (Misdirected Request) is appropriate. A simple redirect (code) wouldn’t really work here since the old and new URLs are the same for a moved site (the underlying issue being the DNS resolution), translating into a redirect to self.
Virtualmin blocks access to the files on the site by creating a disabled_by_virtualmin.html file in the root of the site and adding a AliasMatch directive to the virtual host configuration:
AliasMatch ^/.*$ /home/accountfolder/public_html/disabled_by_virtualmin.html
As this is a plain HTML file there’s no way to add a status code to it and all methods I’ve tried to do this by customizing the .htaccess file failed to both apply the status code and keep this “disabled” page functional.
But PHP does allow setting a custom status code, so to add the status code and keep the disabled site/message, I chose to rename this file to .php (to have it processed by PHP) and add the necessary code right at the beginning:
<?php header( "HTTP/1.1 421 Misdirected Request" ); ?><!DOCTYPE html> [....existing html...]
Then update the AliasMatch directive to use the new file:
AliasMatch ^/.*$ /home/accountfolder/public_html/disabled_by_virtualmin.php