


Introduction to RewriteCond rule parameters in Apache_PHP tutorial
The RewriteCond statement in Apache has always been a difficulty for me. I have tried to figure it out many times, but there is no structure. This time I finally know what it means.
RewriteCond is just like the if statement in our program, which means that if one or several conditions are met, the RewriteRule statement immediately below RewriteCond will be executed. This is the most original and basic function of RewriteCond. In order to To facilitate understanding, let’s take a look at a few examples.
<span RewriteEngine on RewriteCond </span>%{HTTP_USER_AGENT} ^Mozilla<span //</span><span 5/.0.*</span> RewriteRule index.php index.m.<span php RewriteCond </span>%{HTTP_USER_AGENT} ^Lynx.*<span RewriteRule index</span>.php index.L.<span php RewriteRule index</span>.php index.b.php
The function of the above statement is that when you use FF browser to access the index.php file, it will automatically allow you to access the index.m.php file. When you use some mobile When you access the file through the terminal, you will actually access index.L.php when accessing the file index.php. If you access it using another browser, you will be redirected to index.b.php. Speaking more vividly, the above statement is equivalent to the following statement in the program (take the PHP statement as an example):
<span if</span>(<span $_SERVER</span>['HTTP_USER_AGENT'] == 'Mozilla/5.0'<span ) { </span><span //</span><span 跳转到对index.m.php的访问</span> <span } </span><span else</span> <span if</span>(<span $_SERVER</span>['HTTP_USER_AGENT'] == 'Lynx'<span ) { </span><span //</span><span 跳转到对index.L.php的访问</span> <span } </span><span else</span> <span //</span><span 跳转到对index.b.php的访问</span>
Looking at Example 2:
RewriteCond %{HTTP_REFERER} (www.test.cn)
RewriteRule (.*)$ test.php
The effect of the above statement is that if the host address of the previous page you visited is www.test.cn, no matter which page you are currently visiting, you will jump to the test .php access.
Looking at Example 3:
RewriteCond %{REMOTE_HOST} ^host1.*<span [OR] RewriteCond </span>%{REMOTE_HOST} ^host2.*<span [OR] RewriteCond </span>%{REMOTE_HOST} ^host3.*<span RewriteRule (</span>.*)$ test.php
The function of the above statement is that if your address is host1 or host2 or host3, it will jump to test.php. It can be seen from here that the default between RewriteCond statements is AND. If you want OR, you must write it explicitly.
Here are some useful rewrite rules that you have collected:
RewriteCond % {REQUEST_FILENAME} !-d //#If the directory exists, directly access the directory without performing RewriteRule
RewriteCond %{REQUEST_URI} !^.*(/.css|/. js|/.gif|/.png|/.jpg|/.jpeg)$ //#If it is a file with these suffixes, access the file directly without Rewrite
http://www.bkjia.com/PHPjc/440360.html

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



2024 is the first year of AI mobile phones. More and more mobile phones integrate multiple AI functions. Empowered by AI smart technology, our mobile phones can be used more efficiently and conveniently. Recently, the Galaxy S24 series released at the beginning of the year has once again improved its generative AI experience. Let’s take a look at the detailed function introduction below. 1. Generative AI deeply empowers Samsung Galaxy S24 series, which is empowered by Galaxy AI and brings many intelligent applications. These functions are deeply integrated with Samsung One UI6.1, allowing users to have a convenient intelligent experience at any time, significantly improving the performance of mobile phones. Efficiency and convenience of use. The instant search function pioneered by the Galaxy S24 series is one of the highlights. Users only need to press and hold

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.

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

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

In C/C++, the pointer comparison rules are as follows: pointers pointing to the same object are equal. Pointers to different objects are not equal. Exception: Pointers to null addresses are equal.

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.

KubernetesOperator simplifies PHP cloud deployment by following these steps: Install PHPOperator to interact with the Kubernetes cluster. Deploy the PHP application, declare the image and port. Manage the application using commands such as getting, describing, and viewing logs.

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
