Home  >  Article  >  Backend Development  >  How to write pseudo-static rules in windows and linux

How to write pseudo-static rules in windows and linux

WBOY
WBOYOriginal
2016-07-25 08:53:341413browse
  1. [isapi_rewrite] #This sentence is to enable disguised static rules
  2. rewriterule /([0-9]+).html /contents.php?w=$1 [i]
Copy code

anything with The address starting with a number goes to contents.php?w=$1. This $1 represents the previous ([0-9]+) received content, and the following means it is not case-sensitive.

So how to use letters:

  1. rewriterule /([a-z]+).html /contents.php?w=$1 [i]
Copy code

Just change the number to the range of letters you need.

How to represent all word symbols:

  1. rewriterule /tag_(.*).html /search.php?s=$1 [i]
Copy code

Second, the Linux pseudo-static file name is: .htaccess rules:

  1. rewriteengine on #This sentence is to enable disguised static rules
  2. rewriterule ([0-9]+).html$ /contents.php?w=$1 [l,nc]
Copy code

Any address starting with a number goes to contents.php?w=$1. This $1 represents the previous ([0-9]+) received content, and the following [l,nc] represents case-insensitive.

The letter representation is the same as windows

How to represent all word symbols:

  1. rewriterule tag_(.*).html$ /search.php?s=$1 [l,nc]
Copy code

Through the above method, I believe you already know how to use pseudo-static rules, Just place the above files in the root directory of the space. As long as the space supports the above method, any language, asp, .net, php, jsp can be used. Pseudo-static can make the page URL look refreshing. As for SEO, Zhongshuo Fengyun, I don’t know if it has any effect.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn