<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="css/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>企业网站推广 - URL重写优化</title><link>http://www.wangleiseo.com/</link><description>搜索引擎优化 网站排名 百度 GOOGLE  王雷SEO _ wangleiseo.com ! - </description><generator>RainbowSoft Studio Z-Blog 1.8 Arwen Build 90619</generator><language>zh-CN</language><copyright></copyright><pubDate>Thu, 09 Sep 2010 05:59:13 +0800</pubDate><item><title>如何替换请求URL中的文字</title><author>a@b.com (aqgege)</author><link>http://www.wangleiseo.com/post/61.html</link><pubDate>Sun, 14 Mar 2010 10:04:12 +0800</pubDate><guid>http://www.wangleiseo.com/post/61.html</guid><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 以下解决方案，仅适用于Apache服务器。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在.htaccess文件中添加以下语句：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteCond&nbsp; %{REQUEST_URL} &nbsp;&quot;string1&quot;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteRule&nbsp; &quot;(.*)&quot;string1(.*)&quot;&nbsp; &quot;$1string2$2&quot;&nbsp; [N,PT]</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 例如当客户端发出请求URL：example.com/string1/abcstring1.html，则转换为目标URL：example.com/string2/abcstring2.html。其中[N]标记告诉Apache重新执行重写规则，直到RewriteCond失效为止。只要请求URL中包含需要替换的字符串，它就会一直重复地执行。当所有的string1都被替换完毕，则RewriteCond失效。本例子中，RewriteCond执行了2次。[PT]告诉mod_rewrite把重写的URL传送到Apache来进行接下来的处理工作。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我们都知道，关键字是否在URL中对于<a href="http://www.3605713.com/" target="_blank">网站</a><a href="http://www.wangleiseo.com/" target="_blank">SEO</a>至关重要。对于建站初期不注重SEO的站点，特别是大型站点，本功能真是雪中送炭。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 注意：使用本功能时，有时会把非目标字符也做了修改，假如例子中的&ldquo;abcstring1&rdquo;不是目标字符，但这个功能也会替换了它。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 当然，你或许可以通过这个功能获得另外的启发：改版时，如何保留原链接，创建新的URL？</p>]]></description><category>URL重写优化</category><comments>http://www.wangleiseo.com/post/61.html#comment</comments><wfw:comment>http://www.wangleiseo.com/</wfw:comment><wfw:commentRss>http://www.wangleiseo.com/feed.asp?cmt=61</wfw:commentRss><trackback:ping>http://www.wangleiseo.com/cmd.asp?act=tb&amp;id=61&amp;key=7b7dba9b</trackback:ping></item><item><title>改版时，如何保留原链接，创建新的URL？</title><author>a@b.com (aqgege)</author><link>http://www.wangleiseo.com/post/60.html</link><pubDate>Sun, 14 Mar 2010 10:02:18 +0800</pubDate><guid>http://www.wangleiseo.com/post/60.html</guid><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 具体操作办法（仅适用于apache网络服务器）：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 文件位置：apache-&gt;conf-&gt;httpd.conf</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 请在httpd.conf中使用Alias指令：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>Alias /newurl /www/htdocs/oldurl</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如：用户访问新的地址example.com/newurl/id34.html 服务器将提供的内容原地址是example.com/www/htdocs/oldurl/id34.html。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 注意：Alias只会改变本地URL，如seowhy.com/newurl/id34.html 的/newurl/id34.html 部分，而无法改变URL的主机名称部分（如：http://www.seowhy.com/部分）。若要更改URL的主机名称部分，请使用Redirect或RewriteRule指令。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 菜鸟指南：本功能的Alias指令在 httpd.conf中是这一句： #Alias /webpath /full/filesystem/path 去掉前面的#，并做下相应的修改即可。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.wangleiseo.com/" target="_blank">SEO</a>过程中一般在这些情况下需要用到该功能：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、当文件移动或文件目录名称发现改变，出于SEO需要，你需要保持旧的URL；</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、<a href="http://www.3605713.com/" target="_blank">网站</a>改版了，网站导航和链接发生变化，为了继续持有原链接带来的流量，你需要保持旧的URL；</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3、你希望不同的人用不同URL来链接同一个的内容。（SEO一般不建议这样做）</p><p>等等。。</p>]]></description><category>URL重写优化</category><comments>http://www.wangleiseo.com/post/60.html#comment</comments><wfw:comment>http://www.wangleiseo.com/</wfw:comment><wfw:commentRss>http://www.wangleiseo.com/feed.asp?cmt=60</wfw:commentRss><trackback:ping>http://www.wangleiseo.com/cmd.asp?act=tb&amp;id=60&amp;key=a7029d9f</trackback:ping></item><item><title>如何将无效的URL重定向到其他页面？</title><author>a@b.com (aqgege)</author><link>http://www.wangleiseo.com/post/59.html</link><pubDate>Sun, 14 Mar 2010 09:58:29 +0800</pubDate><guid>http://www.wangleiseo.com/post/59.html</guid><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 很多时候，我们考虑把无效的URL比如：用户拼错的URL、不存在的URL重定向到别的网页，例如<a href="http://www.3605713.com/" target="_blank">网站</a>的首页、404页面等。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在httpd.conf或.htaccess文件中使用ErrorDocument来捕获404&nbsp;（找不到文件）错误：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorDocument 404 /index.html <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirectoryIndex index.html /path/to/notfound.html</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 本功能会让所有的404错误&mdash;&mdash;每次当某人请求无效的URL 时，都返回URL / index.html 提供的网站首页。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里需要注意两点：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、直接指向首页是否是合适的？或者让它指向到一个404页面会更好些？如果在404页面用javasctrip做一个跳转到首页，也是<a href="http://www.wangleiseo.com/" target="_blank">SEO</a>允许的做法。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、即使返回有效的文件，仍然会将404 状态码返回给客户端和搜索引擎。这表示搜索引擎机器人来确认网站上的链接时，仍然会得到正确的结果（404状态码）。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 关于状态码，你需要了解下：日志中的HTTP状态码都代表什么？</p>]]></description><category>URL重写优化</category><comments>http://www.wangleiseo.com/post/59.html#comment</comments><wfw:comment>http://www.wangleiseo.com/</wfw:comment><wfw:commentRss>http://www.wangleiseo.com/feed.asp?cmt=59</wfw:commentRss><trackback:ping>http://www.wangleiseo.com/cmd.asp?act=tb&amp;id=59&amp;key=b8eb6e9e</trackback:ping></item><item><title>如何把动态链接静态化？</title><author>a@b.com (aqgege)</author><link>http://www.wangleiseo.com/post/58.html</link><pubDate>Sun, 14 Mar 2010 09:56:25 +0800</pubDate><guid>http://www.wangleiseo.com/post/58.html</guid><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这是<a href="http://www.wangleiseo.com/" target="_blank">SEO</a>过程中最经常碰到的问题，也是必须解决的问题。因为搜索引擎喜欢静态页面。从Web服务器的角度，这个问题转变为：如何将静态化的文件名称转化成参数。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 需要两步来处理：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1、把网页上带链接的地方，都换上新的静态化链接。搜索引擎和浏览器将通过该链接来发生请求。（有些人做修改不是在网页上，而是进行动态链接向静态链接的转向，这是严重错误的）</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、在httpd.conf或.htaccess中使用RewriteRule：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RewriteRule &quot;^/dir/ ([^./]*) \.html&quot; &quot;/dir/script.cgi?doc=$1&quot;&nbsp; [PT]</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [PT]标记告诉Apache执行后续的所有操作。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 通过这个功能，使动态页面以静态链接的形式展示给搜索引擎，从而达到URL优化的目的。如SEO十万个为什么整站都是通过该方式实现。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 了解以下文章，有助于你加深对该功能的理解：</p>]]></description><category>URL重写优化</category><comments>http://www.wangleiseo.com/post/58.html#comment</comments><wfw:comment>http://www.wangleiseo.com/</wfw:comment><wfw:commentRss>http://www.wangleiseo.com/feed.asp?cmt=58</wfw:commentRss><trackback:ping>http://www.wangleiseo.com/cmd.asp?act=tb&amp;id=58&amp;key=4ddf3f73</trackback:ping></item><item><title>URL标准化是什么意思？</title><author>a@b.com (aqgege)</author><link>http://www.wangleiseo.com/post/57.html</link><pubDate>Sun, 14 Mar 2010 09:50:20 +0800</pubDate><guid>http://www.wangleiseo.com/post/57.html</guid><description><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; URL标准化，<a href="http://1001.3605713.com/" target="_blank">英文</a>：url canonicalization来自matt cutts的博客文章：<a href="http://www.wangleiseo.com/" target="_blank">SEO</a> advice: url canonicalization&nbsp;中文翻译：SEO的建议：URL标准化&nbsp;&ldquo;URL标准化&rdquo;是一个动名词，不好直接解释，我把它反过来一下：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>什么是一个标准化的URL？</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 很多情况下，我们认为以下这几个链接都指向同一个页面（首页）：</p><ul>    <li>www.example.com</li>    <li>example.com/</li>    <li>www.example.com/index.html</li>    <li>example.com/index.php</li></ul><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 但是从URL发送请求并返回网页内容的过程来看，这些URL都是互不相同的。对于上述URLs，Web服务器完全可以返回完全不同的内容。当这些URL所对应的内容都一样时（一般情况下都一样的），谷歌需要从上述URLs中选一个具有代表性的，而忽略其余的。那么这个被谷歌选择了的URL，就是一个标准化的URL。谷歌选择的这个过程称为&ldquo;标准化&rdquo;。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>谷歌是怎么URL标准化的？</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一般情况下，谷歌根据被外链的数量来判断。采用多的，则是标准化URL。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>我想告诉谷歌我想要的标准化URL，怎么办？</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 采用301重定向进行URL标准化。</p>]]></description><category>URL重写优化</category><comments>http://www.wangleiseo.com/post/57.html#comment</comments><wfw:comment>http://www.wangleiseo.com/</wfw:comment><wfw:commentRss>http://www.wangleiseo.com/feed.asp?cmt=57</wfw:commentRss><trackback:ping>http://www.wangleiseo.com/cmd.asp?act=tb&amp;id=57&amp;key=113e04ef</trackback:ping></item></channel></rss>
