1. First check to see if the server supports pseudo-static.
To view the method:
$arr =apache_get_modules ();
$temp =false;
for ($i =0; $i <count ($arr); $i + +)
{
I f ($arr [$i]== "Mod_rewrite")
{
$temp =true;
}
If Temp=true is supported (can be enabled to display on the Web page), if the WAMP integration environment can be directly see the Apache modules inside the rewrite modules is checked, check support,
2. Let Apache server support. htaccess
Modify the httpd.conf file
Options FollowSymLinks
AllowOverride None
Switch
Options FollowSymLinks
AllowOverride All
After this step is set up, you will have to restart the Apache server to take effect.
3. After the modification is pseudo-static support, build a. htaccess file, which records the pseudo-static rules, examples are as follows:
Rewriteengine on #这句话必须写
#RewriteRule ([A-za-z]{1,})-([0-9]{1,}) \.html$ index.php?action=$1&id=$2
Rewriterule ^ ([0-9]+). html$ list.php?catid=$1 #定义的规则
#list. php?id=1801
#1801. html
Rewriterule ^ ([0-9]+)-([a-za-z_]+). html$ list.php?catid=$1&sort=$2
#list. Php?catid=1801&sort=price_desc
#50010788-price_desc.html
Rewriterule ^ ([0-9]+)-([0-9]+). html$ list.php?catid=$1&page=$2
#list. php?catid=1801&page=2
Rewriterule ^ ([0-9]+)-([a-za-z_]+)-([0-9]). html$ list.php?catid=$1&sort=$2&page=$3
#RewriteRule ([0-9]+)-([a-za-z_]+)-([0-9]+). html$ list.php?catid=$1&sort=$2&page=$3
#list. php?catid=50010788&sort=price_desc&page=2
#50010788-price_desc-2.html
3. Enter 1801.html in the corresponding directory of the website is the equivalent of input? id=1801
This article is from "Buffy Rain Blog" blog, please be sure to keep this source http://bafeiyu.blog.51cto.com/5401101/1602462
PHP set pseudo-static