PHP redirection is different from pseudo-static redirection.
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 WEB server master configuration <DIRECTORY> (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 the <DIRECTORY> web project address in the Apache configuration file and add the following code:
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.