Search Engine Friendly URL Design
Copyright statement: You can reprint at will. When reprinting, please be sure to indicate the original source and author information of the article and this statement in the form of a hyperlink
http://www.chedong.com/tech/google_url.html
Keywords: "url rewrite" mod_rewrite isapirewrite path_info "search engine friendly"
Content summary:
In addition, as the content on the Internet grows at an alarming rate, the importance of search engines becomes more and more prominent. If a website wants to be better indexed by search engines, the website design should not only be user-friendly (User Friendly), but also search engine friendly. The design of (Search Engine Friendly) is also very important. The more page content that enters the search engine, the greater the chance of being found by users using different keywords. In the article Google's Algorithm Survey, it is mentioned that the number of pages indexed by Google on a site actually has a certain impact on PageRank. Since Google highlights the relatively static part of the entire network (the number of dynamic web pages indexed is relatively small), static web pages with relatively fixed link addresses are more suitable for indexing by Google (no wonder many large websites have mailing list archives and monthly archived documents that are easy to index). (searched), so many articles about search engine-oriented URL design optimization (URI Pretty) mention a lot of using a certain mechanism to turn dynamic web page parameters into a form like a static web page:
For example, you can change:
http://www.chedong.com/phpMan.php?mode=man¶meter=ls
becomes:
http://www.chedong.com/phpMan.php/man/ls
There are two main ways to implement it:
Based on url rewrite
Based on path_info
Pass URI address as parameter: URL REWRITE
The simplest is URL conversion based on the URL rewrite module in various WEB servers:
In this way, a link like news.asp?id=234 can be mapped to news/234 without modifying the program. .html, looks the same as a static link from the outside. There is a module (non-default) on the Apache server: mod_rewrite: URL REWRITE is powerful enough to write a book.
When I need to map news.asp?id=234 to news/234.html, I only need to set:
RewriteRule /news/(d+).html /news.asp?id=$1 [N,I ]
This maps requests like /news/234.html to /news.asp?id=234
When there is a request for /news/234.html: the web server will forward the actual request to/news.asp?id=234
There are also corresponding REWRITE modules in IIS: For example, ISAPI REWRITE and IIS REWRITE, the syntax is based on regular expressions, so the configuration is almost the same as apache's mod_rewrite:
For example, for a simple application it can be:
RewriteRule /news/(d+).html /news/news.php?id=$1 [N,I]
In this way, http://www.chedong. com/news/234.html is mapped to http://www.chedong.com/news/news.php?id=234
A more general expression that can parameter map all dynamic pages Yes:
represents http://www.myhost.com/foo.php?a=A&b=B&c=C
as http://www.myhost.com/foo.php/a/A/ b/B/c/C.
RewriteRule (.*?.php)(?[^/]*)?/([^/]*)/([^/]*)(.+?)? $1(?2$2&:? )$3=$4?5$5: [N,I]
Another advantage of using URL REWRITE is that it hides the background implementation, which is very useful when migrating the background application platform: when migrating from asp to java platform, the front-end users will not be able to feel the changes in the background application.
For example, when we need to migrate the application from news.asp?id=234 to news.php?query=234, the front-end performance can always remain news/234.html. From the realization of separation of application and front-end performance: the stability of the URL is maintained, and using mod_rewrite can even forward the request to other back-end servers.
URL beautification based on PATH_INFO
Another way to beautify URLs is based on PATH_INFO:
PATH_INFO is a CGI 1.1 standard. It is often found that many "/value_1/value_2" following CGI are PATH_INFO parameters:
For example, http://www.chedong .com/phpMan.php/man/ls, in: $PATH_INFO = "/man/ls"
PATH_INFO is a CGI standard, so PHP Servlet, etc. have full support. For example, there is the request.getPathInfo() method in Servlet.
Note: getPathInfo() of /myapp/servlet/Hello/foo returns /foo, and getPathInfo() of /myapp/dir/hello.jsp/foo will return /hello.jsp. From here you can also You can know that jsp is actually the PATH_INFO parameter of a Servlet. ASP does not support PATH_INFO.
An example of parameter parsing based on PATH_INFO in PHP is as follows:
//Note: Parameters are split by "/", and the first parameter is empty: from /param1/param2 Parse out the two parameters $param1 $param2
if ( isset($_SERVER["PATH_INFO"]) ) {
list($nothing, $param1, $param2) = explode('/', $_SERVER ["PATH_INFO"]);
}
How to hide an application: For example, .php, extension:
Configure it like this in APACHE:
How to make it more like a static page: app_name/my/app.html
When parsing the PATH_INFO parameter, put Just truncate the last 5 characters ".html" of the last parameter.
Note: PATH_INFO is not allowed by default in APACHE2. You need to set AcceptPathInfo on
Especially for users who use virtual hosts and do not have the right to install and configure mod_rewrite, PATH_INFO often becomes the only choice. .
OK, so when you see a webpage like http://www.example.com/article/234 in the future, you will know that it may be a dynamic webpage generated by the php program article/show.php?id=234 , many sites may appear to have many static directories, but in fact they are most likely using 1 or 2 programs to publish content. For example, many WIKIWIKI systems use this mechanism: the entire system is a simple wiki program, and the seemingly directory is actually the query result of this application using the following address as a parameter.
Using a solution based on MOD_REWRITE/PATH_INFO + CACHE server to transform the original dynamic publishing system can also greatly reduce the cost of upgrading the old system to a new content management system. And it facilitates search engine indexing.
Attachment: How to use PHP to support the ISAPI mode installation of PATH_INFOPHP on IIS. Note: Just try php-4.2.3-Win32
Unpacking directory
========
php-4.2.3-Win32.zip c:php
PHP.INI initialization file
=================
Copy: c: phpphp.ini-dist to c:winntphp.ini
Configure file association
============
Configure file association as described in install.txt
Runtime library file
==========
Copy c:phpphp4ts.dll to c:winntsystem32php4ts.dll
After running like this: you will find that php changes PATH_INFO Mapped to the physical path
Warning: Unknown(C:CheDongDownloadsariadnewwwtest.phppath): failed to create stream: No such file or directory in Unknown on line 0
Warning: Unknown(): Failed opening 'C :CheDongDownloadsariadnewwwtest.phppath' for inclusion (include_path='.;c:php4pear') in Unknown on line 0
Install ariadne's PATCH
============== ====
Stop IIS service
net stop iisadmin
ftp://ftp.muze.nl/pub/ariadne/win/iis/php-4.2.3/php4isapi.dll
Override The original c:phpsapiphp4isapi.dll
Note:
ariadne is a content publishing system based on PATH_INFO.
PATH_INFO of CGI mode in PHP 4.3.2 RC2 has been corrected, just install it as usual.
References:
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 turns out to be articel.php?id=485
An open source content management system based on PATH_INFO
http://typo3.com/
What doesn't Google index?
http://www.microdocs-news.info/newsGoogle/2003/05/10.html
Google's PageRank description:
http://pr.efactory.de/

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software