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

- 原文链接：https://www.xintheme.com/wpjiaocheng/515.html
- 发布日期：2018-05-07
- 更新时间：2021-12-12
- 作者：大胡子 | XinTheme
- 分类目录：WordPress教程
- 标签：WordPress、WordPress伪静态、WordPress固定链接、WordPress程序

## 摘要

这是一篇很早就应该写的文章，就在刚刚还有朋友在群里问WordPress伪静态的问题，今天这篇文章我就来跟大家说一下，关于WordPress程序在win和Linu...

## 正文

这是一篇很早就应该写的文章，就在刚刚还有朋友在群里问[WordPress伪静态](https://www.xintheme.com/wpjiaocheng/515.html)的问题，今天这篇文章我就来跟大家说一下，关于[WordPress](https://www.xintheme.com)程序在win和Linux系统下的伪静态设置方法，网站进行伪静态设置，对SEO优化是有着非常重要的作用。

第一种：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&amp;paged=$2  
> RewriteRule /tag/(.+)$ /index\\.php\\?tag=$1  
> \# For category（中文分类以及分类翻页的规则）  
> RewriteRule /category/(.\*)/page/(\\d+)$ /index\\.php\\?category\_name=$1&amp;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点击保存就可以了。这样我们win系统下的WordPress程序伪静态就完成了。

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

这一种就是非常简单的，我们知道Linux系统本身使用WordPress是最完美的系统，它的伪静态设置是非常简单的，我们只需要在后台→固定链接选择自定义链接输入/%category%/%post\_id%.html或是/%post\_id%.html点击保存就可以了。下面我就将Linux系统支持的.htaccess伪静态规则内容写出来。代码如下:

> \# BEGIN WordPress
> 
> RewriteEngine On  
> RewriteBase /  
> RewriteRule ^index\\.php$ - \[L\]  
> RewriteCond %{REQUEST\_FILENAME} !-f  
> RewriteCond %{REQUEST\_FILENAME} !-d  
> RewriteRule . /index.php \[L\]
> 
> \# END WordPress

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

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