When dynamic web pages meet search enginesAlthough dynamic web pages have many advantages over static pages,it has hit a big snag in search engine retrieval. Regardless of any website,especially those corporate websites,that are for marketing purposes, no one wants their web pages not to be indexed by search engines. But in fact, :many content pages of dynamic website design cannot be retrieved by search engines.
Generally speaking, search engines will regard the "?" characters appearing in the dynamic web address as "stop mark", in All parameters after it will be ignored. For example, for all subpages , of "index.php?category=x", the search engine finally retrieves only one , That is the page index.php. As a result, , dynamic web pages fall into the embarrassing situation of being unable to be discovered and retrieved by search engines, directly lose the opportunity to be discovered by users and search engines such a broad market space.
Reasons why search engines do not support dynamic web pagesDynamic web pages are driven by databases,
This makes search engines face the danger of countless url and being trapped by the database and falling into an endless loop,This is What we call spider traps(spider traps). And once spider is trapped by the website, its repeated access requests to the database will also cause the website server system to be completely paralyzed. In view of this , search engines will not read the characters after "?" in url of dynamic web pages. php
is converted intohtmlstatic page Although there is no guarantee that every dynamic page will be converted into a static html
file,, but if the website resides on the apache server,You only need a simple small script to convert most dynamic pages into html files. 1.
Make sure you need to convert it into aphp file with the suffix html
Our target is those web pages that contain a lot of dynamic subpages. Take "index.php?category=x" as an example,We need to convert the dynamic subpages after "index.php". For example ,If there is a subdirectory named "arts and crafts" in the website, the url is "index.php?category=1" ,Other subdirectories are different from this url only in the last variable,So we need to modify the server’s response when index.php follows the variable. The way it opens.
2.Notify the server to open a php file after accepting a call request for a html page
We need to place a .htaccess text file in the directory where index.php is located on the server. The .htaccess file is a directory configuration settings file on the apache server,It provides a method to change the configuration for the directory,That is, Place a file (.htaccessfile) containing one or more directives in a specific document directory, to act on this directory and all its subdirectories. The functions of .htaccess include setting web page passwords, setting files that appear when errors occur, changing home page file names, prohibiting reading of file names, redirecting files, adding mime categories, and prohibiting columns. Files in the directory, etc.
When you need to change the server configuration for a directory, but do not have root permissions on the server system, you should use the .htaccess file. If the server administrator is unwilling to frequently modify the configuration ,, he can allow users to modify the configuration ,especially isp through the .htaccess file. When multiple user sites, are provided on one machine and users are expected to change the configuration themselves,, some .htaccess functions will generally be opened for use. The user can set it by himself. For vdeck users, may need to create a text file , and then rename it .htaccess in the management panel. Now we need to specify some variables on the server side. For example, ,I need to change the "?category=x" variable to "directory-x.html",This will eliminate the problem that dynamic pages cannot be Search engine retrieval issues.
在开始创建服务器变量前,我们需要先在这个新建的.htaccess文件中创建一个rewrite engine (url重写工具)。只需要在文件第一行写上
这就等于告诉服务器我们要改变一些文件的处理方式。接下来的一行就要指定重写规则:
这个指令表明:只要接到url中包含“directory-0”到“directory-9”的任意静态网页的页面调用请求,服务器将以“index.php?变量”地址返回给调用用户。
先别急着编辑下一条改写规则,我们有必要在更改实际的php页面之前先进行一下测试。我们可以对上面的"重写规则"进行测试。首先新开一个浏览器窗口,在地址栏中输入“directory-1.htm”或“directory-1.html”,如果我们看到的页面显示为“index.php?category=1”就表明改写规则工作正常。
3.让搜索引擎看到我们的静态化页面
现在,我们需要让搜索引擎能够看到我们经过“改头换面”的新的网页地址。那么,是不是需要赶紧把网站再向搜索引擎提交一遍呢? 不用这么费劲,我们只需打开php文件编辑一下就行了。不过在此之前,应记得将要修改的每个脚本都做个备份,将其存放在硬盘上。然后需要确定创建更改链接地址的程序的不同地方。最好在前端而不要在后台进行更改。php文件将会从.htaccess文件中得到形如“index.php?category=x”之类的信息。我们需要把这些动态生成的网页地址更改一下,并以静态化页面地址显示给用户和搜索引擎。即将所有url中包含“index.php?category=”的部分替换为“directory-”,并加上.html后缀。
Once you find an area to be modified, check for errors at any time after making changes. If there are errors in the script that are not found,it can be quite tricky to correct,especially if you are not familiar with phpcoding. rewriteengine on
rewriterule ^directory-([0-9]*.* index.php?category=$1 [l,nc]
The above is the detailed content of How to convert php dynamic web page to html?. For more information, please follow other related articles on the PHP Chinese website!

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

html5支持boolean值属性;boolean值属性指是属性值为true或者false的属性,如input元素中的disabled属性,不使用该属性表示值为flase,不禁用元素,使用该属性可以不设置属性值表示值为true,禁用元素。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
