PHP redirection vs. pseudo-static differences

Source: Internet
Author: User
Pseudo-Static is an important method of SEO, through redirection to achieve, and can be redirected to hide the technology of the site, filtering abnormal access. This lesson is divided into two parts, the first half detailing the basics of Apache redirection, the second half of which deepens the understanding of redirection through multiple real-world cases, and demonstrates the actual effects of various redirection settings.

What is pseudo-static

Pseudo-Static is relative to the true static speaking
Pseudo-static simply changes the URL to a static form, actually a dynamic Web page
Pseudo static SEO with true static

What is redirection (very often key learning)

Reposition the network request in one direction and go to another location
is divided into internal and external, the difference is external redirection, the URL in the browser address bar will be changed
HTTP was originally supported for redirection 3XX
Pseudo-Static using redirection technology

Redirected Environment Build-up

Installing the Web server (Apache/nginx)
Loading the mod_rewrite.so module

REDIRECT implementation (there are 3 main types)

By configuring the Web server Master configuration <DIRECTORY> (production environment)
Through. htaccess (development environment)
Implementation via scripting (external redirection)

. htaccess Redirection Implementation Steps

First step: Configure allowoverride All (restart) in the Apache master configuration file
Step Two: Configure in the. htaccess file

Rewriteengine on Rewriterule ^ (. *) \.html$ $1.php  //Match HTML to PHP

Web server master Configuration implementation redirection

Locate the <DIRECTORY> is the Web project address directly in the Apache configuration file plus the following code:

Rewriteengine on Rewriterule ^ (. *) \.html$ $1.php  //Match HTML to PHP

Rewriterule Syntax Description

Rewriterule matching pattern replacement URL [flags]
Match pattern supports regular expressions and rewrite variables in prel format
The replacement URL supports the result of matching pattern with the rewrite variable
Multiple flags are separated by commas (for example: [R=301,c])

Rewriterule Flags Description

R Force external redirection, browser address bar URL will change, 301 permanent Redirect, 302 temporary Redirect, example: [R=301],[r] (on behalf of 301)
C link the next rule, if there are more than one rule, then the current plus [C] rule and the next rule becomes a whole, the first day does not match, then the next one does not enter
L stop matching the following rules, if there are multiple rules, when the rule matches with [L], then the match of the following rule is stopped
NE does not escape special characters for URLs
NC is case insensitive
G requested page failed, server returned 410
QSA used to intercept query strings in URLs

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.