一个很有用的apache指令SetEnvIf
SetEnv 指令 说明 设置环境变量 语法 SetEnv env-variable value SetEnvIf 指令 说明 根据客户端请求属性设置环境变量 语法 SetEnvIf attribute regex [!]env-variable [= value ] [[!] env-variable [= value ]] ... 作用域 server config, virtual host, d
SetEnv 指令
说明 | 设置环境变量 |
---|---|
语法 | SetEnv <var>env-variable</var> <var>value</var> |
SetEnvIf 指令
说明 | 根据客户端请求属性设置环境变量 |
---|---|
语法 | SetEnvIf <em>attribute regex [!]env-variable</em>[=<em>value</em>] [[!]<em>env-variable</em>[=<em>value</em>]] ... |
作用域 | server config, virtual host, directory, .htaccess |
SetEnvIf
指令根据客户端的请求属性设置环境变量。第一个参数attribute必须是下列三种类别之一:
-
一个HTTP请求头域(参见RFC2616);例如:
Host
,User-Agent
,Referer
,Accept-Language
。可以用一个正则表达式来进行匹配。 - 下列请求属性之一:
-
Remote_Host
远程主机名(若可用) -
Remote_Addr
远程主机IP地址 -
Server_Addr
接收到请求的服务器IP地址(2.0.43及以后版本) -
Request_Method
所用的请求方法(GET
,POST
等等) -
Request_Protocol
请求所使用的协议及其版本("HTTP/0.9", "HTTP/1.0", "HTTP/1.1"等) -
Request_URI
在HTTP请求行中请求的资源(通常是URL中去除协议、主机以及查询字符串后剩余的部分)。
-
- 列出的与该请求关联的环境变量名字中的一个。这将允许
SetEnvIf
指令基于预先匹配的结果进行测试。只有那些由较早的SetEnvIf[NoCase]
指令定义的环境变量才可以按照这种方式测试。"较早的"意思是它们在更上层的作用域(比如全局范围)中被定义或者在同一作用域中较早出现。只有在请求的属性未能得到匹配并且attribute没有使用正则表达式的时候,环境变量才会被考虑。
如:不记录192.168.7.139的访问日志
首先设置环境变量 SetEnvIf Remote_Addr "192\.168\.7\.139" dontlog
使用上面设置的环境变量
CustomLog "logs/access_log" common env=!dontlog
SetEnvIfNoCase
说明: Sets environment variables based on attributes of the request without respect to case
语法: SetEnvIfNoCase attribute regex [!]env-variable[=value] [[!]env-variable[=value]] ...
上下文: 服务器配置, 虚拟主机, 目录, .htaccess
覆盖项: FileInfo
状态: Base
模块: mod_setenvif
兼容性: Apache 1.3 and above
The SetEnvIfNoCase is semantically identical to the SetEnvIf directive, and differs only in that the regular expression matching is performed in a case-insensitive manner. For example:
SetEnvIfNoCase Host Apache\.Org site=apache
This will cause the site environment variable to be set to "apache" if the HTTP request header field Host: was included and contained Apache.Org, apache.org, or any other combination.
SetEnvIfNoCase 当满足某个条件时,为变量赋值,一般结合其他指令使用。
如:
1。SetEnvIf Request_URI "/logo(.)+" local_ref=0
Allow from env=local_ref 当local_ref有值时,可以访问。
2。SetEnvIfNoCase Request_URI .js$ useless-file
CustomLog logs/hebgc.com/access.log combined env=!useless-file
当满足条件时才记录日志。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

According to benchmarks, Laravel excels in page loading speed and database queries, while CodeIgniter excels in data processing. When choosing a PHP framework, you should consider application size, traffic patterns, and development team skills.

Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

To add a server to Eclipse, follow these steps: Create a server runtime environment Configure the server Create a server instance Select the server runtime environment Configure the server instance Start the server deployment project

There are a variety of attack methods that can take a website offline, and the more complex methods involve technical knowledge of databases and programming. A simpler method is called a "DenialOfService" (DOS) attack. The name of this attack method comes from its intention: to cause normal service requests from ordinary customers or website visitors to be denied. Generally speaking, there are two forms of DOS attacks: the third and fourth layers of the OSI model, that is, the network layer attack. The seventh layer of the OSI model, that is, the application layer attack. The first type of DOS attack - the network layer, occurs when a large number of of junk traffic flows to the web server. When spam traffic exceeds the network's ability to handle it, the website goes down. The second type of DOS attack is at the application layer and uses combined

1. Background of the Construction of 58 Portraits Platform First of all, I would like to share with you the background of the construction of the 58 Portrait Platform. 1. The traditional thinking of the traditional profiling platform is no longer enough. Building a user profiling platform relies on data warehouse modeling capabilities to integrate data from multiple business lines to build accurate user portraits; it also requires data mining to understand user behavior, interests and needs, and provide algorithms. side capabilities; finally, it also needs to have data platform capabilities to efficiently store, query and share user profile data and provide profile services. The main difference between a self-built business profiling platform and a middle-office profiling platform is that the self-built profiling platform serves a single business line and can be customized on demand; the mid-office platform serves multiple business lines, has complex modeling, and provides more general capabilities. 2.58 User portraits of the background of Zhongtai portrait construction

Mobile devices have become an essential part of people's lives in modern society. Games have also become one of the main forms of entertainment in people's spare time. There are constantly people working on developing new tools and technologies to optimize gameplay and improve the gaming experience. The input method with its own MC command is one of the eye-catching innovations. And how it can bring a better gaming experience to players. This article will delve into the infinite possibilities of the built-in MC command input method. Introduction to the built-in MC command input method. The built-in MC command input method is an innovative tool that combines the functions of MC commands and intelligent input methods. This enables more operations and functions. By installing the input method on a mobile device, players can easily use various commands in the game. Enter commands quickly to improve game efficiency

To successfully deploy and maintain a PHP website, you need to perform the following steps: Select a web server (such as Apache or Nginx) Install PHP Create a database and connect PHP Upload code to the server Set up domain name and DNS Monitoring website maintenance steps include updating PHP and web servers, and backing up the website , monitor error logs and update content.

How to Implement PHP Security Best Practices PHP is one of the most popular backend web programming languages used for creating dynamic and interactive websites. However, PHP code can be vulnerable to various security vulnerabilities. Implementing security best practices is critical to protecting your web applications from these threats. Input validation Input validation is a critical first step in validating user input and preventing malicious input such as SQL injection. PHP provides a variety of input validation functions, such as filter_var() and preg_match(). Example: $username=filter_var($_POST['username'],FILTER_SANIT
