RewriteEngine叙述在强制所有重写? [英] RewriteEngine On mandatory for all rewrites?

查看:224
本文介绍了RewriteEngine叙述在强制所有重写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道是否有必要包括RewriteEngine叙述上并重写基地/每次我加了改写?例如,我想用这两个和在某些时段白天^对文件块的访问(示例从askapache.com报价)

I was just wondering if it would be necessary to include the RewriteEngine On and Rewrite Base / each time I add a rewrite? For example I would like to use both the "Removes the QUERY_STRING from the URL ^" and "block access to files during certain hours of the day ^" (Examples quoted from askapache.com)

删除QUERY_STRING从网址

Removes the QUERY_STRING from the URL

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} .
RewriteRule ^login.php /login.php? [L]

在特定的时间为一天,以文件的数据块存取^

block access to files during certain hours of the day ^

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# If the hour is 16 (4 PM) Then deny all access
RewriteCond %{TIME_HOUR} ^16$
RewriteRule ^.*$ - [F,L]

我都不可能将它们合并成以下?

Can I possibly combine them into the following?

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} .
RewriteRule ^login.php /login.php? [L]
# If the hour is 16 (4 PM) Then deny all access
RewriteCond %{TIME_HOUR} ^16$
RewriteRule ^.*$ - [F,L]

在此先感谢您的时间。

Thanks in advance for your time.

推荐答案

RewriteEngine叙述的RewriteBase 要只能指定一次。

这篇关于RewriteEngine叙述在强制所有重写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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