when a Dynamic Web page encounters a search engine
Although dynamic Web pages have many advantages over static pages , they touch a big nail in search engine retrieval. No matter any website , especially those marketing-based corporate websites , no one would want their pages to be retrieved by search engines. But the fact is : the dynamic site design of many content pages are not searchable search engines, get more php Video Tutorial Please pay attention to http://www.lampbrother.net Brother even education.
In general , the search engine will put the "?" appearing in the Dynamic web address. The character is treated as a stop tag , and all parameters after it are ignored. For example, to "Index.php?category=x" all the sub-pages , the search engine finally retrieved the URL only one , that is index.php This one page. In this way , the Dynamic Web page is caught in the search engine can not be found and retrieval of embarrassment , directly lost the opportunity to be discovered by users and search engines such a broad market space.
Why the search engine does not support Dynamic Web pages
Dynamic Web pages are driven by databases , which makes it dangerous for search engines to be trapped in a dead loop with countless URLs , which is what we call spider traps (spiders traps). And once the spider is covered by the Web site , its repeated requests for access to the database can also cause a complete paralysis of the Web server system. In view of this , the search engine for the Dynamic Web page contains "?" in the URL . All subsequent characters are not read.
php converted to HTML static page
While there is no guarantee that each dynamic page will be converted to a static HTML file , if the site resides on the Apache server , you can convert most dynamic pages into a single HTML file.
1. determine the php file that needs to be converted to HTML suffix
Our goal is to include pages with more dynamic sub-pages in their name. Taking "Index.php?category=x" as an example , we need to convert the dynamic sub-page after "index.php" . For example , if the site has a subdirectory named "Arts and Crafts" , the URL is "Index.php?category=1", the other subdirectories and the The URL is only different on the last variable , so we need to modify how the server opens it when index.php follows the variable.
2. notifies the server to open a php file after accepting a call request from an HTML page
We need to place a . htaccess text file in the same directory as index.php on the server. The . htaccess file is a directory configuration settings file on the Apache Server , which provides a way to change the configuration for a directory , That is, place a file (. htaccess file ) with one or more instructions in a specific document directory, to work on this directory and all of its subdirectories. The features of . htaccess include setting the Web page password, setting the file that appears when the error occurs, changing the home page file name, preventing the file name from being read, re-directing files, adding the MIME category, preventing files in the column directory, and so on.
If you need to change the configuration of the server for the directory , and if you do not have root permissions on the server System , should use the . htaccess file. If the server administrator does not want to frequently modify the configuration , can allow users to modify the configuration themselves via the . htaccess file , especially ISP To provide multiple user sites on a single machine , and if you want users to be able to change their own configuration , will generally open the section . htaccess features are set to users. For vdeck users , may need to first create a text file , and rename it to . htaccess in the admin panel. Now we need to specify some variables on the server side. Let's say , I need to change the ? category=x variable to "directory-x.html", this will eliminate the problem that dynamic pages cannot be retrieved by search engines.
Before we start creating server variables , We need to create a rewrite engine (URL rewrite tool )in this new . htaccess file. Only need to write on the first line of the file
Rewriteengine on
This is tantamount to telling the server that we want to change the way some files are handled. The next line will specify the rewrite rule :
rewriterule^directory-([0-9]*.* index.php?category=$1 [L,NC]
This instruction indicates that whenever a page call request is received from any static Web page that contains "directory-0" to "directory-9" in the URL , the server will "index.php?" Variable " address is returned to the calling user.
Don't worry about editing the next rewrite rule , we need to test it before changing the actual PHP page. We can test the " rewrite rule " above. First open a new browser window , enter "directory-1.htm" or "directory-1.html" in the address bar, if we see the page displayed as "index.php?" Category=1 " indicates that the rewrite rule is working correctly.
3. Let the search engine see our static page
now , we need to let the search engine see the new page address we passed makeover . So , is it necessary to quickly submit the site to the search engine again ? don't bother. , We just open the php file and edit it. But before you do , Remember to make a backup of each script you want to modify , to store it on your hard disk. Then you need to determine the different places to create the program that changed the link address. It is best to make changes in the front end rather than in the background. The php file will get information like "Index.php?category=x" from the . htaccess file. We need to change these dynamically generated page addresses to , and display the static page address to the user and search engine. Replace the section with "index.php?category=" in all URLs with "directory-", and . HTML Suffix.
Once you have found the area to be modified , Check for errors at any time after the change. If there are errors in the script that are not found , it is quite tricky to correct them , especially in the case of PHP Coding
Unfamiliar with the case.
PHP Getting Started training tutorial how to convert PHP Dynamic Web page to HTML