暂时禁用PHP网站

Cru*_*her 1 php security iis-6 web

我有一个我拥有的PHP网站.我想在进行更改时暂时禁用网站(还有很多工作要做).我尝试重命名该index.php文件,但最终用户可以通过键入URL(或者如果他已经为页面添加了书签)来导航到页面.有没有办法暂时禁用整个网站?

编辑:此接受的答案适用于Apache Web服务器.我目前使用的是IIS6(而不是IIS7,其中可以在web.config文件中完成相同的重写).在IIS6中有没有办法解决这个问题?

Bar*_*tek 5

您可以使用.htaccess文件重定向到维护页面:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=307,L]
Run Code Online (Sandbox Code Playgroud)

一些有用的链接:

http://www.shellhacks.com/en/Redirect-Site-to-Maintenance-Page-using-Apache-and-HTAccess

http://perishablepress.com/htaccess-redirect-maintenance-page-site-updates/

http://wp-mix.com/maintenance-mode-htaccess/