apache服务器开启伪静态步骤

建站交流12年前 (2013-06-27)12790
伪静态 首先:
必须要空间支持 Rewrite 以及对站点目录中有 .htaccess 的文件解析,才有效.
如何让空间支持Rewrite 和 .htaccess 的文件解析呢 往下看
第一步:要找到apache安装目录下的httpd.cof文件,在里面找到

Options FollowSymLinks
AllowOverride none

把none改all,
第二步:找到以下内容:
#LoadModule rewrite_module modules/mod_rewrite.so
改为
LoadModule rewrite_module modules/mod_rewrite.so
第三步:保存重启apache。
ok。
其次是.htaccess的书写规则:


RewriteEngine On
RewriteBase /
#打开允许符号链接
Options FollowSymLinks
RewriteRule smarty/([0-9]+)/([0-9]+) smarty/index.php?id=$1&name=$2


.htaccess加入以下内容
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)list-id([0-9]+)\.html$ $1/company/search.php?sectorid2=$2
RewriteRule ^(.*)cominfo-([a-z0-9]+)\.html$ $1/member/index.php?uid=$2&type=cominfo
RewriteRule ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1/plus/list.php?typeid=$2&PageNo=$3
RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.lujin\.com$
RewriteCond %{HTTP_HOST} !^(www|bbs)\.lujin\.com$
RewriteRule ^/?$ /%{HTTP_HOST}
RewriteRule ^/([a-z0-9\-]+)\.lujin\.com/?$ /member/index.php?uid=$1 [L]
对上面的一些解释
RewriteRule ^(.*)list-id([0-9]+)\.html$ $1/company/search.php?sectorid2=$2
这条是把企业库的分类进行伪静态处理
原先假设访问地址为[url]http://www.xxx.com/company/search.php?sectorid2=1[/url]
现在地址为[url]http://www.xxx.com/list-id1.html[/url]

优点:1、伪静态处理加速搜索引擎收入
2、地址映射到根目录,增加权重,提高排名

“apache服务器开启伪静态步骤” 的相关文章

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。