eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« Oracle OpenWorld 2005 | Blog首页 | MT read counter-增加Blog文章浏览计数器 »

应用Apache的rewrite技术 实现面向搜索引擎优化
modb.pro

关键词:mod_rewrite,apache,httpd.conf,RewriteEngine

今天重新编译了一下apache,尝试了一下apache极其强大的rewrite技术,主要做了以下几件工作:
1.重新编译apache,启用rewrite模块
2.修改httpd.conf文件,设置重新规则
3.增加了一个php函数,对留言板的程序进行格式化

我的apache使用的版本是:


[root@eygle logs]# apachectl -v
Server version: Apache/2.0.54
Server built: Sep 21 2005 18:03:29

编译正确的话,在httpd.conf文件中应该看到增加类似如下一行:
LoadModule rewrite_module modules/mod_rewrite.so

然后就可以设置
RewriteEngine on
打开重写引擎,定义RewriteRule进行查询改写(总觉得把Oracle的这个名词放在这里比较合适:)).

apache的rewrite功能可以把形如:
http://www.eygle.com/gbook/index.php?&setid=980
这样的url改写为:
http://www.eygle.com/gbook/980.html
从而实现搜索引擎友好化。

强大的正则表达式功能可以使这样的改写变得千变万化。

在完成了以上这些工作之后,对于我的留言板的访问,都实现了静态格式转换,比如之前的第100页,现在可以通过html静态页进行访问了。

将动态网页链接rewriting成静态链接可以更好的被搜索引擎访问和Cache,从而可以更好的和用户交互。

在修改的过程中,参考了几篇很好的文档:
http://www.chedong.com/tech/google_url.html
http://www.hzqbbc.com/blog/arch/2005/05/apache_rewritec.html
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html


历史上的今天...
    >> 2015-09-25文章:
    >> 2012-09-25文章:
    >> 2010-09-25文章:
    >> 2009-09-25文章:
    >> 2008-09-25文章:
    >> 2006-09-25文章:
           今年月又到中秋

By eygle on 2005-09-25 13:18 | Comments (3) | Web | 447 |

3 Comments

也就是说实质上不存在静态页面,只是有一个这样的路径,apache会自动转向动态页面,是吧?:)


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com