Pseudo-static URL rewriting technology implementation method php asp

  

pseudo-static use of knowledge is very simple Once learned, happy endless, only need regular and server settings.
First, how to set up iis, look down
download (IIS Rewrite module): http://www.isapirewrite.com/, first download the product, install it on the server, remember the directory, will There is a file like Rewrite.dll generated, MMC → IIS Information Service Manager → Website → Your Site → Properties, click “Add” in the “ISAPI Filter” item, fill in the Rewrite with the filter name, and the executable file is Rewrite. Dl this file.

Then modify the httpd.ini configuration file, if you are not familiar with it, look at the manual at http://www.isapirewrite.cn/docs, study, so:


[ISAPI_Rewrite]
CacheClockRate 3600
RewriteRule ^(.*)/([a-z0-9A-Z\\-]+\\.html)$ $1/default.asp\\?id=$2

This configuration can get the parameters in default.asp, no problem, by the way, the most important symbol in the regular usage ^ matches the beginning, $ matches the end, \\w matches any character, \\ s matches blank, + matches at least one, * matches at least 0, [x,] matches at least x, () is a grouping technique, sweat, this thing is not said, too weak.


The following said apache (the most popular WEB server platform on Unix platform) Write technology, basically similar, but apoceh supports more flexible .htaccess, you create a file, the file name is .htaccess: content:


RewriteEngine On
RewriteRule ^( [a-z0-9A-Z\\-]+\\.html)$default.php\\?id=$1


In this case, get it. Note that you must have space to support Rewrite and to the site. The file parsing of .htaccess in the directory is valid.

How to make the space support Rewrite and .htaccess file parsing?

Step 1: We need to find apache (the most Unix platform) The popular http://server platform) httpd.cof file in the installation directory, found in

<Directory />
Options FollowSymLinks
AllowOverride none
</Directory>
Change none to all,
Step 2: Find the content

#LoadModule rewrite_module modules/mod_rewrite.so

Change to

LoadModule rewrite_module modules/mod_rewrite. So

The third step is the most difficult, save the restart apache (the most popular WEB server platform on Unix platform). I need to study it myself.

The rest is testing. . I have passed the above settings.

Copyright © Windows knowledge All Rights Reserved