在Godaddy免费空间上设置WordPress的固定链接

  由于Godaddy的免费空间(购买域名赠送)和经济型空间(ECONOMY PLAN)均不提供URL的重写功能,给WordPress的固定链接设置带来了一定的麻烦,但并不是不能实现,请参考下面的步骤:
  1.在虚机主机上根目录下找到web.config文件,将原代码:
<configuration>
    <system.webServer>
        <httpErrors errorMode=”Detailed” />
        <asp scriptErrorSentToBrowser=”true”/>
    </system.webServer>
    <system.web>
        <customErrors mode=”Off”/>
        <compilation debug=”true”/>
    </system.web>
</configuration>
  改为:
<configuration>
    <system.webServer>
        <httpErrors errorMode=”Detailed” />
        <asp scriptErrorSentToBrowser=”true”/>
        <rewrite>
          <rules>
          <rule name=”Main Rule” stopProcessing=”true”>
          <match url=”.*” />
          <conditions logicalGrouping=”MatchAll”>
          <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
          <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
          </conditions>
          <action type=”Rewrite” url=”index.php” />
          </rule>
          </rules>
        </rewrite>
    </system.webServer>
    <system.web>
        <customErrors mode=”Off”/>
        <compilation debug=”true”/>
    </system.web>
</configuration>
  这样就完成了web.config文件的修改。

  2.下面以让WordPress的URL显示以“分类—文章名”的形式展示为例:
  在WordPress的后台打开“设置—固定链接”,然后在常规设置重选择自定义,在输入框中填写“/%category%/%postname%/”,然后“保存更改”。如果想生成伪静态,则可以在输入框中填写“/%category%/%postname%.html”即可。
  再点击“文章—分类目录”,添加新的分类目录,注意“分类目录名”即为前台显示的分类目录,“分类目录别名”即在地址栏显示的链接(注意不能为汉字,否则职能显示汉字的代码,不利于搜索引擎收录),然后添加分类目录就完成了。注意:整个过程中会提示修改web.config文件,可不予理会。
  在写文章时,只需勾选相应的分类目录,文章的URL地址即引用其相应的别名了。

2 comments

Add Comment

Required fields are marked *. Your email address will not be published.