谷歌外贸独立站建站教程三:运用WordPress固定链接设置教程,最佳结构及修改
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">想设置WordPress固定链接?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress固定链接<span style="color: black;">一般</span>指网站里的 URL <span style="color: black;">位置</span>,设置时有 6 种结构可选,新手很难<span style="color: black;">晓得</span>哪一种最适合 SEO 优化、搜索引擎收录和社交分享。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在本文中,我会教你最佳WordPress固定链接设置和修改 URL 的<span style="color: black;">办法</span>,下面是完整教程。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">目录</strong> </p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">什么是WordPress固定链接</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">WordPress最佳固定链接设置</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;"><span style="color: black;">怎样</span>修改WordPress固定链接</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">1. 伪静态规则设置</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">2. 固定链接404</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">3. 更改类别和标签URL</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">4. 修改<span style="color: black;">文案</span>和页面URL</span>
</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> <span style="color: black;">总结</span>
</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">什么是WordPress固定链接</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress固定链接是网站页面或<span style="color: black;">文案</span>的 URL 链接,<span style="color: black;">包含</span>网站主页、普通页面、<span style="color: black;">制品</span>页面、文章、类别和标签在内,每一个网页都有自己的固定链接。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">举个例子,本文固定链接是:https://www.baidudy.me/wordpress-permalinks.html</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">它的<span style="color: black;">重点</span>目的是方便搜索引擎抓取和社交分享,格式相对固定,一旦设置好就不要轻易改动。</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">WordPress最佳固定链接设置</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">设置WordPress固定链接,链接结构最好<span style="color: black;">选取</span><span style="color: black;">文案</span>名,如下所示。它有利于Google SEO,在<span style="color: black;">必定</span>程度上还能让你的网站被谷歌快速收录。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/fctWInfC0mZJ1yB1icssc414Q3n6HCD2603iaPyWZOE2V0VF7ae6gqwIpw3jTusgiaCBWY3TMKkg30DTv08qZGGYg/640?wx_fmt=png&from=appmsg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress固定链接设置<span style="color: black;">办法</span>:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">登录你的WordPress网站,在左侧菜单栏找到设置选项。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">依次点击设置 > 固定链接。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">点击固定链接之后,在右边你会看到固定链接结构设置选项,一共有 6 种可选。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后,结构<span style="color: black;">选取</span><span style="color: black;">文案</span>名,并<span style="color: black;">保留</span>更改,就设置好最佳WordPress固定链接了。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress固定链接结构解释:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">朴素:<span style="color: black;">运用</span>页面自动分配的 ID <span style="color: black;">做为</span>固定链接,对搜索引擎毫无<span style="color: black;">道理</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">日期和名<span style="color: black;">叫作</span>型:固定链接中<span style="color: black;">包括</span>发布日期和名<span style="color: black;">叫作</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">月份和名<span style="color: black;">叫作</span>型:<span style="color: black;">表示</span>月份和年份的固定链接。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">数字型:纯数字的固定链接,适合社区或论坛<span style="color: black;">运用</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">文案</span>名:<span style="color: black;">运用</span><span style="color: black;">文案</span>名<span style="color: black;">做为</span>固定链接,后续<span style="color: black;">能够</span>自定修改链接名<span style="color: black;">叫作</span>,有利于谷歌SEO。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">自定义结构:伪静态设置或把前几种类型组合到<span style="color: black;">一块</span>的固定链接。</p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><span style="color: black;">怎样</span>修改WordPress固定链接</span></h2>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1. 伪静态规则设置</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">伪静态设置是一种专门针对动态化网页的静态处理,20年前非常流行。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">它<span style="color: black;">一般</span>以 .html 为网页<span style="color: black;">位置</span>后缀,有利于SEO优化。<span style="color: black;">不外</span>,WordPress和其它建站系统<span style="color: black;">区别</span>,它的固定链接本身<span style="color: black;">便是</span>静态,<span style="color: black;">因此</span>新手用WordPress建站,是无需设置伪静态的。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">但有一种<span style="color: black;">状况</span>要<span style="color: black;">重视</span>,<span style="color: black;">倘若</span>你的网站年代久远,早已启用了伪静态,<span style="color: black;">此刻</span>想更换建站系统,<span style="color: black;">运用</span>WordPress,为了<span style="color: black;">保存</span>以前的URL<span style="color: black;">位置</span>不影响SEO,那需要做伪静态设置,<span style="color: black;">办法</span>如下。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">首要</span>,在WordPress固定链接设置里更改自定义结构,添加 /%postname%.html</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/fctWInfC0mZJ1yB1icssc414Q3n6HCD266BrUDlibFKmUeLbCUcfW0RMFgUxxxFniblfjy29KGbTWibzictS2iaNic8gQ/640?wx_fmt=png&from=appmsg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">而后</span>,在你的主机或云服务器里添加以下代码。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">Nginx 伪静态规则</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一般</span>适用于云服务器和宝塔面板,需配置类似 wordpress.conf 名<span style="color: black;">叫作</span>的文件。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">location </span><span style="color: black;">/</span><span style="color: black;">{</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(-</span><span style="color: black;">f $request_filename</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">html</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;"> $1</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">html </span><span style="color: black;">break</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(-</span><span style="color: black;">f $request_filename</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;"> $1</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(!-</span><span style="color: black;">f $request_filename</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">Nginx 二级目录规则</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">下面<span style="color: black;">咱们</span>以 blog 二级目录为例。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">location </span><span style="color: black;">/</span><span style="color: black;">blog</span><span style="color: black;">/</span><span style="color: black;">{</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(-</span><span style="color: black;">f $request_filename</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">html</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;"> $1</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">html </span><span style="color: black;">break</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(-</span><span style="color: black;">f $request_filename</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;"> $1</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if</span><span style="color: black;">(!-</span><span style="color: black;">f $request_filename</span><span style="color: black;">){</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> rewrite </span><span style="color: black;">(.*)</span><span style="color: black;">/</span><span style="color: black;">blog</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php</span><span style="color: black;">;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">}</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">Apache 规则</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">适用于虚拟主机,配置 .htaccess 文件,大<span style="color: black;">都数</span><span style="color: black;">状况</span>下无需设置。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><ifmodule</span><span style="color: black;">mod_rewrite</span><span style="color: black;">.</span><span style="color: black;">c</span><span style="color: black;">></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> RewriteEngine On</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> RewriteBase /</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> RewriteRule ^index\.php$ - </span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> RewriteCond %{REQUEST_FILENAME} !-f</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"> RewriteCond %{REQUEST_FILENAME} !-d</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteRule . /index.php </span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"></ifmodule></span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2. 固定链接404</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>你设置完WordPress固定链接,<span style="color: black;">显现</span>404错误,需要手动修复固定链接设置,<span style="color: black;">办法</span>如下。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">第1</span>种,重新<span style="color: black;">保留</span>一次WordPress固定链接设置选项。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">第二种,手动更新 .htaccess 文件,覆盖以前的代码(需做备份)。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># BEGIN WordPress</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><</span><span style="color: black;">IfModule</span><span style="color: black;"> mod_rewrite</span><span style="color: black;">.</span><span style="color: black;">c</span><span style="color: black;">></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteEngine</span><span style="color: black;">On</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteBase</span><span style="color: black;">/</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteRule</span><span style="color: black;">^</span><span style="color: black;">index\.php$ </span><span style="color: black;">-</span><span style="color: black;">[</span><span style="color: black;">L</span><span style="color: black;">]</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteCond</span><span style="color: black;">%{</span><span style="color: black;">REQUEST_FILENAME</span><span style="color: black;">}</span><span style="color: black;">!-</span><span style="color: black;">f</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteCond</span><span style="color: black;">%{</span><span style="color: black;">REQUEST_FILENAME</span><span style="color: black;">}</span><span style="color: black;">!-</span><span style="color: black;">d</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">RewriteRule</span><span style="color: black;">.</span><span style="color: black;">/</span><span style="color: black;">index</span><span style="color: black;">.</span><span style="color: black;">php </span><span style="color: black;">[</span><span style="color: black;">L</span><span style="color: black;">]</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"></</span><span style="color: black;">IfModule</span><span style="color: black;">></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"># END WordPress</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3. 更改类别和标签URL</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">大<span style="color: black;">都数</span><span style="color: black;">状况</span>下,WordPress类别和标签的固定链接为 /category/ 和 /tag/,<span style="color: black;">倘若</span>你要修改它们,<span style="color: black;">能够</span>转到设置 > 固定链接,修改成你想要的名<span style="color: black;">叫作</span>,并<span style="color: black;">保留</span>修改。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/fctWInfC0mZJ1yB1icssc414Q3n6HCD26P1KT278EL2Q0R0T9xhfA3HRLicqGfUBAXE2YWUtc7Mvtl1HpkwSGJEQ/640?wx_fmt=png&from=appmsg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">4. 修改<span style="color: black;">文案</span>和页面URL</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>你想修改<span style="color: black;">文案</span>和页面里的URL<span style="color: black;">位置</span>,<span style="color: black;">能够</span>转到该页面编辑草稿,在右边选项里找到URL,点击修改URL里面的名<span style="color: black;">叫作</span>,完成后<span style="color: black;">保留</span>修改。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/fctWInfC0mZJ1yB1icssc414Q3n6HCD26CbLianuvFd6QHyhbYibwDWD2gQ1Lu5w0iaAiaYJv4dU6auxIg8leRfanaA/640?wx_fmt=png&from=appmsg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">总结</span></h2>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在本文中,<span style="color: black;">咱们</span>介绍了WordPress固定链接设置及<span style="color: black;">有些</span>修改<span style="color: black;">办法</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span>设置最佳WordPress固定链接,网站会更利于搜索引擎收录,社交分享和谷歌SEO优化。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后,小龙要提醒的是,一旦设置好固定链接,就不要再轻易改动,否者会对网站<span style="color: black;">导致</span>影响。</p>
期待与你深入交流,共探知识的无穷魅力。 楼主听话,多发外链好处多,快到碗里来!外链论坛 http://www.fok120.com/ 我完全赞同你的观点,思考很有深度。
页:
[1]