PHP redirection and pseudo-static

Source: Internet
Author: User
Pseudo-static is an important method of SEO. it is implemented through redirection, and the website technology can be hidden through redirection to filter out abnormal access. This course is divided into two parts. the first half describes the basic knowledge of Apache redirection, and the second half further deepens the understanding of redirection through multiple practical cases, the actual effect of various redirection settings is also demonstrated. Pseudo-static is an important method of SEO. it is implemented through redirection, and the website technology can be hidden through redirection to filter out abnormal access. This course is divided into two parts. the first half describes the basic knowledge of Apache redirection, and the second half further deepens the understanding of redirection through multiple practical cases, the actual effect of various redirection settings is also demonstrated.

What is pseudo-static

Pseudo-static is relatively static.
The pseudo-static mode only changes the URL to the static mode. In fact, it is still a dynamic webpage.
Pseudo-static SEO with the same static

What is redirection (important learning)

Redirect network requests to another location
Divided into internal and external, the difference is that when external redirection, the URL in the browser address bar will change
Http originally supports Redirection 3XX
Use redirection technology for pseudo-static

Redirect environment construction

Install the web server (apache/nginx)
Load mod_rewrite.so module

Redirection implementation (mainly including 3 methods)

Configure the master configuration of the WEB server (Production Environment)
Use. htaccess (Development Environment)
Implement (external redirection) through scripts)

. Htaccess redirection implementation steps

Step 1: Configure allowOverride All in the apache Main configuration file (restart)
Step 2: configure in the. htaccess file

RewriteEngine on RewriteRule ^ (. *) \. html $ 1.php // Change matching html to php

WEB server master configuration for redirection

Directly find in the Apache configuration file Add the following code to the web Project address:

RewriteEngine on RewriteRule ^ (. *) \. html $ 1.php // Change matching html to php

RewriteRule syntax description

URL replaced by RewriteRule matching mode [flags]
The matching mode supports regular expressions in Prel format and rewrite variables.
The replaced URL supports matching results and rewrite variables.
Multiple flags are separated by commas (,) (for example, [R = 301, C]).

RewriteRule flags description

R forces external redirection. the url in the address bar of the browser will change. 301 will be permanently redirected and 302 will be temporarily redirected. for example: [R = 301], [R] (representing 301)
C links the next rule. if there are multiple rules, the rule Currently added with [C] becomes a whole with the next rule. if the first day does not match, the next rule will not enter
L stop matching the following rules. if there are multiple rules, when the [L] rule is added, the matching of the following rules will be stopped.
NE does not escape special characters of the URL
NC is case insensitive
If the webpage of the G request is invalid, the server returns 410
QSA is used to intercept query strings in URLs.

For more articles about the differences between PHP redirection and pseudo-static data, refer to the PHP Chinese website!

Related articles:

Three methods for php page redirection

Two methods to redirect URL parameters in JavaScript

Redirect to external links

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.