Use Apache rewrite to generate pseudo-static pages

Source: Internet
Author: User

We know that the search engine is preference for static pages, so, put such as: http://www.jianglb.com /? Change the p = 123 page to http://www.jianglb.com/apaeche-rewrite.htmlto show benefits for searching.

However, if the address file does not exist in http://www.jianglb.com/apaeche-rewrite.html, the error file does not exist.

This requires the useApacheThe rewrite module redirects these URLs to a dynamic program such as index. php. Of course, index. php also needs a program to identify these addressesDatabaseAccess data.

Enable rewrite. Make sure that the apache configuration file is in httpd. conf.
LoadModule rewrite_module libexec/mod_rewrite.so

The directory where the website is located defines the following
Rong:
Options Indexes FollowSymLinks
AllowOverride all

The website directory must also contain a. htaccess
Content:
Rewriteengine on
Rewritebase/
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule./index. php [L]

In this case, the URL request is automatically sent to index. php.

 
 
I wrote a positive expression.
RewriteRule ^ /*(.*?) /R _(.*?) -(.*?) -(.*?) -(.*?) -(.*?). Html $1/$ 2.php? Type1 = $3 & type2 = $4 & type3 = $5 & page = $6
The pseudo-static format is r_xxx- 1- 2- 3- 4.html.
Regular value expression. If there is a variable, r_xxx-variant 1.html
The two variables are r_xxx- 1- 2.html.
Three variations are r_xxx- 1- 2- 3.html

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.