What is pseudo static: A brief introduction to mod_rewrite knowledge

Source: Internet
Author: User

WordPress before the time often involved in pseudo static, that is, mod_rewrite this noun, and then the beginning of the time is not very clear, only know is used to convert the address for HTML included, today finally found a better article, sent up with you to study together, What is called pseudo static mod_rewrite,

The following is a brief introduction to Mod_rewrite's knowledge:

First you have to turn on Apache's mod_rewrite function.

In the Apache directory apache\conf this folder httpd.conf file with Notepad open edit, find the following sentence:

#LoadModule Rewrite_module modules/mod_rewrite.so

Remove the # number from the front, and turn it into:

LoadModule Rewrite_module modules/mod_rewrite.so

Then find the following sentence in the same file:

AllowOverride None

Change it to read:

AllowOverride All

Then close and save the file. As a result, Apache's mod_rewrite function is turned on, very simple.

Below, I want to implement such a URL with mod_rewrite:

Http://xxx.com/0725.html

Http://xxx.com/0726.html

Http://xxx.com/0727.html

...

The link above means to show what happened in the history of July 25, something like that. This looks very beautiful, neat, seemingly generated HTML. However, their address is actually:

http://xxx.com/index.php?today=0725

http://xxx.com/index.php?today=0726

http://xxx.com/index.php?today=0727

...

Now I just want to implement the index.php?today= as static. Here's the code:

1..htaccess file

Rewriteengine on

Rewritebase/

Rewritecond%{request_filename}!-f

Rewritecond%{request_filename}!-d

Rewriterule ^ ([0-9]+) \.html$/index.php?today=$1

Bold word Here I explain, the other in this format, I do not understand the specific now.

[0-9] means that the parameter can only be 0~9 these numbers, if you want to include any characters, change to:

Rewriterule ^ (. +) \.html$/index.php?today=$1

Here [0-9] was replaced. , this. Represents any character

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.