开发者

How to show site offline message during Drupal Site's MySQL database maintenance

开发者 https://www.devze.com 2023-01-21 16:46 出处:网络
I need to put my Drupal Site in offline/maintenance mode whence my SQL server is undergoing maintenance. I cant change the settings for offline mode in Drupal database because MYSQL would be inaccessi

I need to put my Drupal Site in offline/maintenance mode whence my SQL server is undergoing maintenance. I cant change the settings for offline mode in Drupal database because MYSQL would be inaccessible.

Any other method to do it?

Thanks in a开发者_开发问答dvance!


You could use htaccess (for Apache, or the equivalent in IIS Manager) to redirect to a non-drupal page during database maintenance, otherwise it will indeed show a database error even in "offline" mode, preferably a "302" type of redirect.


Add $conf['site_offline'] = 1; to the config file for your site.


Wildpeaks has right. Here is an .htaccess example that complete the answer.

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^your.ip.address.here
RewriteCond %{REQUEST_URI} !^/maintenance/(.)*$ [NC]
RewriteCond %{REQUEST_URI} !.(css|gif|jpe?g?|png|ico) [NC]
RewriteRule ^(.*)$ /maintenance/index.html [R=302,L]

Details available on a nice article wrote by Byju John: how-to-redirect-to-a-maintenance-page-using-htaccess

0

精彩评论

暂无评论...
验证码 换一张
取 消