htaccess的:如何重定向所有页面,以保持页 [英] htaccess: how to redirect all pages to a holding page

查看:161
本文介绍了htaccess的:如何重定向所有页面,以保持页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经把一个网站下来约一个半小时,而我们把第二个服务器到位。使用的.htaccess,我怎么能任何要求 domain.com 重定向到 domain.com/holding_page.php

解决方案

 选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteCond%{REQUEST_URI}!/holding_page.php$

重写规则$ /holding_page.php$l [R = 307,L]
 

使用307(感谢 Piskvor !),而不是302 - 的 307指

  

所请求的资源所在   暂时得到不​​同的URI。   由于重定向可以被改变   有时,客户端应该   继续使用Request-URI为   将来的请求。

I have to put a site down for about half an hour while we put a second server in place. Using .htaccess, how can I redirect ANY request to domain.com to domain.com/holding_page.php?

解决方案

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/holding_page.php$ 

RewriteRule $ /holding_page.php$l [R=307,L]

Use 307 (thanks Piskvor!) rather than 302 - 307 means:

The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.

这篇关于htaccess的:如何重定向所有页面,以保持页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆