Search Engine friendly URL design _php Tutorial

Source: Internet
Author: User
Search Engine friendly URL design copyright notice: Can be reproduced in any way, please be sure to use hyperlinks in the form of the original source of the article and the author's information and this statement
http://www.chedong.com/tech/google_url.html keyword: "url rewrite" mod_rewrite isapirewrite path_info "search engine Friendly "
Content Summary:
In addition, as the content of the Internet is growing at an alarming rate, the importance of the search engine is becoming more and more prominent, if the website wants to be better indexed by search engines, the website design in addition to user-friendly (friendly), search engine-friendly (search engine Friendly) design is also very important. The more pages you enter into a search engine, the more likely you are to find them with different keywords. In Google's algorithm survey article mentions a site by Google index page number actually to PageRank also has certain influence. Because Google highlights the relatively static part of the entire network (the dynamic page index is small), the link address of the relatively fixed static web page is more appropriate to be indexed by Google (no wonder that many large sites of the mailing list archive and monthly documents are very easy to search), so a lot about the search engine-oriented The URL design optimization (URI pretty) article mentions a lot of ways to use a mechanism to turn dynamic page parameters into a static Web page:
For example, you can:
Http://www.chedong.com/phpMan.php?mode=man&parameter=ls
Become:
Http://www.chedong.com/phpMan.php/man/ls
There are 2 main ways of implementation:
URL rewrite based on path_info to use URI addresses as parameter passing: URL rewrite
The simplest is the URL translation based on the URL rewriting (Rewrite) module in various Web servers:
This allows almost no modification of the program's implementation to map news.asp?id=234 such a link into news/234.html, which looks like a static link from the outside. There is a module on the Apache server (not the default): Mod_rewrite:url rewrite powerful enough to write a book.
When I need to map news.asp?id=234 into news/234.html, just set:
rewriterule/news/(\d+) \.html/news\.asp\?id=$1 [N,i]
This will map the request like/news/234.html to/news.asp?id=234.
When there is a request for/news/234.html: The Web server forwards the actual request to/news.asp?id=234
And in IIS there are corresponding REWRITE modules: such as ISAPI REWRITE and IIS REWRITE, the syntax is based on regular expressions, so the configuration is almost identical to Apache Mod_rewrite: Compared to a simple application can be:
rewriterule/news/(\d+) \.html/news/news\.php\?id=$1 [N,i]
So we can map http://www.chedong.com/news/234.html to http://www.chedong.com/news/news.php?id=234.

A more general expression that can be used to map all dynamic pages to parameters is:
Put Http://www.myhost.com/foo.php?a=A&b=B&c=C
Act as Http://www.myhost.com/foo.php/a/A/b/B/c/C.
Rewriterule (. *?\.php) (\?[ ^/]*)?/([^/]*)/([^/]*)(.+?)? $ (? 2$2&:\?) $3=$4?5$5: [N,i]
One of the benefits of using URL Rewrite is to hide the background implementation, which is useful when migrating to a background app platform: When migrating from ASP to the Java platform, the foreground user is less likely to experience changes in the background app. For example, when we need to migrate applications from news.asp?id=234 to news.php?query=234, the performance of the foreground can remain as news/234.html. Separation from implementation and foreground performance: URL stability is maintained, and mod_rewrite can even be used to forward requests to other backend servers.
Another way to beautify URLs based on Path_info URLs is based on Path_info:
Path_info is a CGI 1.1 standard and often finds that many of the "/value_1/value_2" behind the CGI are path_info parameters:
such as Http://www.chedong.com/phpMan.php/man/ls, middle: $PATH _info = "/man/ls"
Path_info is a CGI standard, so there is support for PHP servlet and so on. For example, there is a Request.getpathinfo () method in the servlet.
Note:/myapp/servlet/hello/foo's GetPathInfo () returns/foo, while/myapp/dir/hello.jsp/foo's GetPathInfo () will return the/ Hello.jsp, from here you can also know that JSP is actually a servlet path_info parameters. ASP does not support Path_info,

Examples of Path_info-based parameter parsing in PHP are as follows:
Note: The parameter is split by "/", the first parameter is empty: Parse out the $param1 $param 2 2 parameters from the/PARAM1/PARAM2
if (Isset ($_server["Path_info")) {
List ($nothing, $param 1, $param 2) = explode ('/', $_server["Path_info"]);
}

How to hide apps: for example,. php, Extension:
In Apache this configuration:

Forcetype application/x-httpd-php


How to more like static pages: app_name/my/app.html
When parsing the Path_info parameter, the last 5 characters of the last parameter, ". html", are truncated.
Note: The default in APACHE2 is not to allow path_info, you need to set acceptpathinfo on

Especially for the use of virtual host users, not authorized to install and configure Mod_rewrite, Path_info often become the only choice.

OK, so you can see a Web page similar to http://www.example.com/article/234 and you know it might be a dynamic Web page generated by article/show.php?id=234 this PHP program, Many site surfaces may appear to have many static catalogs, in fact, it is possible to use 1, 2 programs implemented content publishing. For example, many WikiWiki systems use this mechanism: the entire system is a simple wiki program, and the look of the directory is actually the application to take the following address as the parameters of the query results.

Using the Mod_rewrite/path_info + cache server-based solution to transform the original dynamic publishing system can greatly reduce the cost of upgrading the old system to a new content management system. and convenient for the search engine included in the index. Attached: How to use PHP to support Path_infophp's ISAPI mode installation memo on IIS: try only to Php-4.2.3-win32

Unpacking Directory
========
Php-4.2.3-win32.zip c:\php

Php. INI initialization file
=================
Replication: C:\php\php.ini-dist to C:\winnt\php.ini

Configuration file Associations
============
Follow the instructions in Install.txt to configure file associations

Run library files
==========
Copy C:\php\php4ts.dll to C:\winnt\system32\php4ts.dll

After this run: you will find PHP mapping Path_info to the physical path
Warning:unknown (C:\CheDong\Downloads\ariadne\www\test.php\path): Failed to create stream:no such file or directory in Un Known on line 0

Warning:unknown (): Failed opening ' C:\CheDong\Downloads\ariadne\www\test.php\path ' for inclusion (include_path= '.; C:\php4\pear ') in Unknown on line 0

Installing Ariadne Patches
==================
Stop the IIS Service
net stop IISAdmin
Ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.2.3/php4isapi.dll
Overwrite the original C:\php\sapi\php4isapi.dll

Note:
Ariadne is a path_info-based content publishing system that
The path_info of the CGI mode in PHP 4.3.2 RC2 has been fixed and can be installed as usual.
Resources:
URL Rewrite Documentation:
http://www.isapirewrite.com/docs/
Http://httpd.apache.org/docs/mod/mod_rewrite.html
Http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html
Search engine-friendly URL design
http://www.sitepoint.com/article/485
Maybe this URL is articel.php?id=485.
An open source content management system based on PATH_INFO
http://typo3.com/
What does Google not index?
Http://www.microdocs-news.info/newsGoogle/2003/05/10.html
Google's PageRank Description:
http://pr.efactory.de/

http://www.bkjia.com/PHPjc/314578.html www.bkjia.com true http://www.bkjia.com/PHPjc/314578.html techarticle Search Engine friendly URL design copyright notice: Can be reproduced in any way, please be sure to use hyperlinks in the form of the original source of the article and the author information and this statement http://www.chedong.com ...

  • 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.