ser*_*hio 3 php apache maintenance redirect
我的PHP站点在维护.如何将访问者重定向到"维护站点"单页?
我听说过app_offline.htmASP.NET的一些事情.
PHP有类似的东西吗?
Linux 版本5.2.13下的Apache 2.2.15
版
Amy*_*y B 14
你真的没有提供足够的细节(服务器,框架等).如果您使用的是Apache,请添加到.htaccess:
# prevent infinite redirect loops
RewriteCond %{REQUEST_URI} !^/back-soon-updating.php$
# not on development server
RewriteCond %{HTTP_HOST} .com$
# let admins enter to verify the update has worked
RewriteCond %{QUERY_STRING} !c=u
RewriteRule .* back-soon-updating.php [L,R=307]
Run Code Online (Sandbox Code Playgroud)
作为我在Linux下的Apache,我执行以下操作:
在站点根目录下创建".htaccess"文件,其中包含以下内容:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/images/mainetnance.png$
RewriteCond %{REQUEST_URI} !/maintenance.php$
# here filter the developer's IP/
#RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888
RewriteRule $ /maintenance.php [R=302,L]
Run Code Online (Sandbox Code Playgroud)
我要添加以过滤.png文件,因为我使用了一个图像(/images/mainetnance.png)作为maintenance.php,并且由于全局重定向,此图像应该保持可见.