设置备用的内容,直到一个特定的日期与Apache重写规则和的RewriteCond [英] Set alternate content until a specific date with Apache RewriteRule and RewriteCond

查看:135
本文介绍了设置备用的内容,直到一个特定的日期与Apache重写规则和的RewriteCond的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要成为一个在建的页面,直到一个特定的日期,但我会出当天的新的内容需要显示国门,一个星期后半(我知道,第一世界的问题。 ..)

I need to serve an under construction page until a specific date, but I will be out of the country on the day the new content needs to display, and for a week and a half after (I know, first world problems...)

我目前在我的httpd-vhosts.conf文件服务的under_construction页。

What I currently have serving the under_construction page in my httpd-vhosts.conf file.

RewriteRule ^(.*)$ \
http://localhost:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/under_construction/VirtualHostRoot$1 [L,P]

下面我想用的,但我不完全理解它应该如何工作的,当然,因为它没有正确配置,它不能正常工作。我试图改变了时间字符串得到它重启后改变了几分钟,但配置可能是不正确的开始。

What I would like to use is below, but I don't fully understand how it should work, and of course it isn't working properly because it isn't configured properly. I have tried changing out the time string to get it to change a few minutes after the restart, but the configuration is probably not right to begin with.

RewriteRule ^(.*)$ \
RewriteCond ^{TIME} < 201304220000
http://localhost:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/under_construction/VirtualHostRoot$1 [L,P]

RewriteRule ^(.*)$ \
RewriteCond ^{TIME} > 201304220000
http://localhost:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/content/VirtualHostRoot$1 [L,P]

我是至少在正确的轨道?此外,除了本地主机:80 /服务器的状态,有没有办法看到的Apache(日期,时间等)的状态,从终端实例?任何帮助将大大AP preciated!

Am I at least on the right track? Also, besides localhost:80/server-status, is there any way to see the status of Apache (date, time, etc.), from Terminal for instance? Any help would be greatly appreciated!

推荐答案

不允许有空格的比较操作符和的 CondPattern

Spaces are not allowed between the comparison operator and the CondPattern

RewriteCond %{TIME} <20130422000000
RewriteRule ^(.*)$ \
http://localhost:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/under_construction/VirtualHostRoot$1 [L,P]

RewriteCond %{TIME} >=20130422000000
RewriteRule ^(.*)$ \
http://localhost:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/content/VirtualHostRoot$1 [L,P]

另外,不要忘了使用&GT; = &LT; = ,这取决于你是否要打开这一天或晚一天。

Also don't forget to use >= or <=, depending on whether you want to switch on that day or a day later.

这篇关于设置备用的内容,直到一个特定的日期与Apache重写规则和的RewriteCond的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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