张力-实战网络营销导师
专注于网络营销推广+Wordpress建站,只做有思想的高价值网站,只提供有担当的营销服务!
文章496浏览3640027本站已运行1360

wordpress程序在win和Linux系统下的伪静态设置

这是一篇很早就应该写的文章,而在昨天就有朋友问我,为什么不写一下关于wordpress的伪静态设置呢?今天这篇文章我就来跟大家说一下,关于wordpress程序在win和Linux系统下的伪静态设置方法。

第一种:win系统下的wordpress程序伪静态。

wordpress在win系统下的伪静态前提是必须空间系统支持伪静态设置,而我们也知道一般win系统支持的伪静态规则为httpd.ini格式的,那我们首先就先新建一个文本文档,将以下代码复制粘贴在里面(这是我至今为止搜集到的最完美的win系统伪静态规则)。

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# wordpress 伪静态规则
# For tag(中文标签以及标签翻页的规则)
RewriteRule /tag/(.*)/page/(\d+)$ /index\.php\?tag=$1&paged=$2
RewriteRule /tag/(.+)$ /index\.php\?tag=$1
# For category(中文分类以及分类翻页的规则)
RewriteRule /category/(.*)/page/(\d+)$ /index\.php\?category_name=$1&paged=$2
RewriteRule /category/(.*) /index\.php\?category_name=$1
# For sitemapxml
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /sitemap.html /sitemap.html [L]
RewriteRule /sitemap_baidu.xml /sitemap_baidu.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

将以上代码复制粘贴到文本文档后,我们再将文本另存为httpd.ini,这样我们的伪静态规则就弄好了,我们只需要将这个文件上传到空间更目录,如果在后台→固定链接选择自定义链接输入/%category%/%post_id%.html或是/%post_id%.html点击保存就可以了,这里面我们还需要一个插件的支持,那就是去除分类URL中间的category,我们只需要在后台插件→安装插件那搜索WP No Category Base,安装启用就可以了。这样我们win系统下的wordpress程序伪静态就完成了。

第二种:Linux系统下的伪静态设置

这一种就是非常简单的,我们知道Linux系统本身使用wordpress是最完美的系统,它的伪静态设置是非常简单的,我们只需要在后台→固定链接选择自定义链接输入/%category%/%post_id%.html或是/%post_id%.html点击保存就可以了。同样它这里也是需要配合WP No Category Base插件的,下面我就将Linux系统支持的.htaccess伪静态规则内容写出来。代码如下:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

以上代码也是一样,需要我们新建一个文本文档,然后将代码复制粘贴进去,点击另存为.htaccess文件,再将此文件上传至空间根目录下就完成了。

这篇文章就写到这里了,希望对那些在使用wordpress程序时不知道伪静态怎么设置的朋友有一些帮助,如果大家有什么不明白的,可以留言给我,谢谢!

您还未添加分享代码,请到主题选项中,添加百度分享代码!

张力


Warning: Undefined variable $comment_i in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/comments.php on line 19
广告
发表我的评论
取消评论
表情 签到
流汗坏笑撇嘴大兵流泪发呆抠鼻吓到偷笑得意呲牙亲亲疑问调皮可爱白眼难过愤怒惊讶鼓掌

Hi,您需要填写昵称和邮箱!

(14)个小伙伴在吐槽
  1. 弘毅SEO博客
    弘毅SEO博客   Google Chrome 59.0.3071.115   Windows 7
    2017-12-17 21:38

    大神,请教下wp标签怎么设置伪静态.html样式,类似内页的这种模式/%post_id%

    • 张力
      张力   Google Chrome 64.0.3253.3   未知
      2017-12-22 20:19

      @弘毅SEO博客 标签好像没有谁去做伪静态html的吧,你可以搜下插件看看!

  2. 站长百科
    站长百科
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-17 10:16

    这种伪静态的设置方法还是很不错的,很实用

  3. 李凯成博客
    李凯成博客
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-12 16:43

    win系统还没接触过,有机会试试

  4. 郑元水
    郑元水
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-11 18:01

    还是linux空间适合wordpress,省事省力!

  5. 产业报告
    产业报告
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-08 16:09

    linux系统还没接触过

  6. 空渡.博客
    空渡.博客
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-06 12:59

    不错的文章,学习了!

  7. 站长百科
    站长百科
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-06 10:07

    伪静态卡哇伊很好的结合静态和动态网页的有点,对网站建设十分重要

    • 张力
      张力
      Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

      Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

      Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

      Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
         未知   未知
      2013-06-06 10:08

      @站长百科 那是必须的,o(∩_∩)o 哈哈!

  8. 齐霁
    齐霁
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-06 10:02

    看晕了。。

  9. 奇酷网
    奇酷网
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-05 23:11

    看看,学习了!

  10. 孟凤凤博客
    孟凤凤博客
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-05 11:10

    又多学到了一点建站的知识,多谢张哥的分享

  11. 孟凤凤博客
    孟凤凤博客
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-05 11:09

    好东西要拿出来分享,不要藏着咽着,哈哈

  12. 鲨鱼
    鲨鱼
    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 141

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 151

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 156

    Warning: Undefined variable $useragent in /www/wwwroot/zhangliseo/wp-content/themes/ZL-ZMT/functions/admin/comment.php on line 161
       未知   未知
    2013-06-04 18:05

    好吧,回家试试,看一下

隐藏边栏