ber*_*nie 6 .htaccess mod-rewrite
我只是想知道是否有必要在每次添加重写时包含RewriteEngine On和Rewrite Base?例如,我想同时使用"从URL删除QUERY_STRING ^"和"在一天中的某些时段阻止访问文件^"(引自askapache.com的示例)
从URL中删除QUERY_STRING
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} .
RewriteRule ^login.php /login.php? [L]
Run Code Online (Sandbox Code Playgroud)
阻止在一天中的某些时段访问文件^
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# If the hour is 16 (4 PM) Then deny all access
RewriteCond %{TIME_HOUR} ^16$
RewriteRule ^.*$ - [F,L]
Run Code Online (Sandbox Code Playgroud)
我可以将它们组合成以下内容吗?
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]
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的时间.