The answer depends on the Virtual Server setup.
Do your SSL Certificates reside on the F5? Meaning, do you have a Client SSL Profile enabled on the HTTPS Virtual Server?
If you do, then the same iRule will work without causing any issues.
If the HTTPS Virtual Server does not have a Client SSL Enabled (The SSL Certificate is applied on the Server) then you will need to put your redirect to your maintenance page in the location that has the SSL Certificate in order to prevent any SSL Certificate Errors from being displayed to your customers.