Maison> php教程> php手册> le corps du texte

php中实现URL静态化

WBOY
Libérer: 2016-06-06 20:08:23
original
1188 Les gens l'ont consulté

URL 静态化是一个利于搜索引擎的设置,通过 URL 静态化,达到原来是动态的 PHP 页面转换为静态化的 HTML 页面, 当然,这里的静态化是一种假静态,目的只是提高搜索引擎的搜索量 Apache 服务器下配置 URL 静态化的 Rewrite 规则: Apache 2.x 的用户请检查 co

URL 静态化是一个利于搜索引擎的设置,通过 URL 静态化,达到原来是动态的 PHP 页面转换为静态化的 HTML 页面, 当然,这里的静态化是一种假静态,目的只是提高搜索引擎的搜索量 Apache 服务器下配置 URL 静态化的 Rewrite 规则: Apache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码: LoadModule Rewrite_module modules/mod_Rewrite.so 在conf/httpd.conf配置中加入 如: RewriteEngine On RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 案例说明: RewriteRule /products/([0-9]+) /fancy/products.php?id=$1 当你在浏览器地址栏输入 http://www.mysite.com/product/123 时,这个地址被重写为 http://www.mysite.com/fancy/product.php?id=123 Rewrite规则表达式的说明: . 匹配任何单字符 [chars] 匹配字符串:chars [...]
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Recommandations populaires
    Derniers téléchargements
    Plus>
    effets Web
    Code source du site Web
    Matériel du site Web
    Modèle frontal
    À propos de nous Clause de non-responsabilité Sitemap
    Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!