Search Engine friendly URL Design _php Foundation

Source: Internet
Author: User
Tags win32

Search Engine friendly URL design copyright notice: You can reprint, reprint, please be sure to hyperlink form to indicate the original source and author 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 with an alarming rate of growth has become more and more prominent the importance of search engines, if the site wants to be better indexed by search engines, site design In addition to user-friendly (users friendly), search engine friendly (searching Engine The design of friendly) is also very important. The more pages that go into search engines, the more likely they are to be found with different keywords. In Google's algorithm survey in the article mentioned that a site by Google index page number in fact, also has a certain impact on the PageRank. Because Google highlights the relatively static part of the entire network (Dynamic Web pages are smaller indexed), a static web page with a relatively fixed link address is more suitable for Google indexing (no wonder many large websites have mailing lists and archived documents on a monthly basis), so there's a lot of search engine-oriented The article in URL design optimization (URI pretty) mentions a lot of ways to make dynamic page parameters like static Web pages using certain mechanisms:
For example, you would:
Http://www.chedong.com/phpMan.php?mode=man&parameter=ls
Become:
Http://www.chedong.com/phpMan.php/man/ls
There are 2 main ways to achieve this:
Based on the URL rewrite the URI address is used as a parameter pass based on path_info: URL rewrite
The simplest is the URL conversion based on the URL rewrite steering (Rewrite) module in various Web servers:
This will almost certainly not modify the implementation of the program to map news.asp?id=234 such links into news/234.html, from the outside looks like static links. 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 to news/234.html, just set:
rewriterule/news/(\d+) \.html/news\.asp\?id=$1 [N,i]
This maps a request like/news/234.html to a/news.asp?id=234
When a request is made to/news/234.html: The Web server will send the actual request to/news.asp?id=234
In the case of 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 the same as Apache Mod_rewrite: More than for a simple application can be:
rewriterule/news/(\d+) \.html/news/news\.php\?id=$1 [N,i]
This maps 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 of a parameter 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]
Another benefit of the URL rewrite is the hidden background implementation, which is useful when migrating from the ASP to the Java platform, and for the foreground user, the background application changes are not felt. For example, when we need to migrate applications from news.asp?id=234 to news.php?query=234, the performance of the front desk can remain news/234.html. From the implementation of application and foreground performance separation: the stability of the URL is maintained, and the use of mod_rewrite can even forward requests to other backend servers.
Another way to beautify URLs based on Path_info is based on Path_info:
Path_info is a CGI 1.1 standard and often finds that many of the "/value_1/value_2" following 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 the PHP servlet and so on. For example, there is a Request.getpathinfo () method in the servlet.
Note: the/myapp/servlet/hello/foo getpathinfo () returns/foo, and/myapp/dir/hello.jsp/foo GetPathInfo () returns the Hello.jsp, you can also see from here that JSP is actually a servlet's path_info parameter. ASP does not support Path_info,

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

How to conceal applications: for example. PHP, Extension:
Configure this in Apache:
<filesmatch "^app_name$" >
Forcetype application/x-httpd-php
</FilesMatch>

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

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

OK, so after you see a page like http://www.example.com/article/234, you know it might be a dynamic Web page generated by article/show.php?id=234 this PHP program, Many site surfaces may seem to have a lot of static directories, but it is possible to publish content that is implemented using 1, 2 programs. 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 a parameter query results.

Using the solution based on Mod_rewrite/path_info + cache server to transform the original dynamic publishing system can greatly reduce the cost of upgrading the old system to the new content management system. and facilitate the search engine included in the index. Attachment: How to use PHP to support path_infophp ISAPI mode installation Memo on IIS: just try to Php-4.2.3-win32

Unpack the Package directory
========
Php-4.2.3-win32.zip c:\php

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

Configuration file association
============
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 operation: you will find that PHP maps 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

Installation of Ariadne patch
==================
Stopping the IIS Service
net stop IISAdmin
Ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.2.3/php4isapi.dll
Cover the original C:\php\sapi\php4isapi.dll

Note:
Ariadne is a path_info based content publishing system,
The path_info of the CGI mode in PHP 4.3.2 RC2 has been fixed and installed as usual.
Resources:
URL Rewrite document:
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/

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.