Pseudo-Static is relatively true static, usually we to enhance the search engine friendly side, will be the article content generated static pages, but some friends in order to display some information in real time. Or you want to use dynamic scripting to solve some problems. You cannot display site content in a static manner. But this loses the friendly side of the search engine. How to find a middle method between the two, which produces pseudo-static technology. Is the display of a static page in the form of HTML, but in fact, a class of ASP dynamic script to deal with.
Pseudo-static name: URL rewrite
Mainly for the purpose of SEO and born. (What is SEO?) You don't have to ask me that. Hehe ~ Do not understand the network SEO that is ~ ~ ~)
Method One:
Like this page.
/soft.php/1,100,8630.html
The script that is actually processed is the soft.php parameter of 1,100,8630
The equivalent of soft.php?a=1&b=1=100&c=8630 only such URLs are too difficult to remember. Search engines don't like it either.
True static just completely generates HTML.
Direct output when the client accesses it. No scripting explanation. It works well when traffic is very large, such as millions of visits per day. That is to say, the server side actually exists this HTML page.
Of course, the traffic on your site is not that big. URL rewriting is the best method (personal view, when large traffic can be considered load balanced.) also no relationship)
There are many ways to rewrite the URL, apache,iisrewrite. Even PHP scripts can be processed directly. For example, in the example above, the PHP script is processed directly (the advantage of this method is that it reduces the pressure of the Web server directly when the traffic is large.) PS: Also a personal point of view:
================================================
The following is a procedure for the example of PHP pseudo-static program implementation method, in fact, this method I have been in other forum community has been sent
Program for example:
/soft.php/1,100,8630.html
CODE:
Use the server variable to get path_info information in this case,/1,100,8630.html is the part that executes the script name.
if (@ $path _info =$_server["Path_info"]) {
Regular match parameters
if (Preg_match ("/\/(\d+), (\d+), (\d+) \.html/si", $path _info, $arr _path)) {$gid =intval ($arr _path[1]);//Get Value 1$sid =intval ($arr _path[2]); Obtained value 100$softid =intval ($arr _path[3]); Obtained value 8630}else die ("path:error!"); /equivalent to soft.php?gid=1&sid=100&softid=8630
It's so simple. ~
Method Two:
One opens the Apache configuration file httpd.conf.
Two will #loadmodule Rewrite_module Modules/mod_rewrite front of the # removed
Three additions in httpd.conf:
<ifmodule mod_rewrite.c>rewriteengine On#rewritecond%{env:script_url} (?: Index|dispbbs) [ -0-9]+. Htmlrewriterule ^ (. *? (?: Index|dispbbs))-([ -0-9]+). HTML 1.php?__is_apache_rewrite=1&__rewrite_arg=2</ Ifmodule> four to implement the ASP post URL to Php post mapping, in the third step between <ifmodule mod_rewrite.c> and </IfModule> add: Rewritemap toLowerCase Int:tolowerrewritecond%{query_string} (?: Boardid|page|id|replyid|star|skin) =d+ [NC]RewriteRule ^ (. * (?: Index|dispbbs). asp 1.php? {tolowercase:%{query_string}}&__is_apache_rewrite=1
Five save httpd.conf and restart Apache
Method Three:
<?php/* Features: PHP pseudo-static page implementation specific usage: for example, the link is: Test.php/year/2006/action/_add.htmlmod_rewrite (); $yearn =$_get["Year"];// The result is ' 2006 ' $action =$_get["action"];//result for ' _add ' */function mod_rewrite () {global $_get; $nav =$_server["Request_uri"];$ script_name=$_server["Script_name"]; $nav =substr (ereg_replace ("^ $script _name", "", UrlDecode ($nav)), 1); $nav =preg_ Replace ("/^.ht (m) {1} (l) {0,1}$/", "", $nav);//This sentence is removed from the tail. html or. htm$vars = Explode ("/", $nav); for ($i =0; $i <count ($ VARs), $i +=2) {$_get["$vars [$i]"]= $vars [$i +1];} return $_get;} Mod_rewrite (); $yearn =$_get["Year"];//result for ' 2006 ' $action =$_get[' action '];//result for ' _add ' echo $yearn; ><?php/*
function: Implementation of PHP pseudo-static page
Specific usage:
For example, the link is: test.php/year/2006/action/_add.html
mod_rewrite (); $yearn =$_get["Year"];//result for ' 2006 ' $action =$_get[' action '];// The result is ' _add ' */function mod_rewrite () {global $_get; $nav =$_server["Request_uri"]; $script _name=$_server["Script_name"] ; $nav =substr (ereg_replace ("^ $script _name", "", UrlDecode ($nav)), 1); $nav =preg_replace ("/^.ht (m) {1} (l) {0,1}$/", "", $NAV);//This sentence is removed from the tail. html or. htm$vars = Explode ("/", $nav), for ($i =0; $i <count ($vars); $i +=2) {$_get["$vars [$i]"]= $vars [ $i +1];} return $_get;} Mod_rewrite (); $yearn =$_get["Year"];//result for ' 2006 ' $action =$_get[' action '];//result for ' _add ' echo $yearn;