也许自己好久没有写程序了,慢慢的什么都给退化了呢,我也有看见wordpress写有.htaccess这个文件,为什么不行呢?后来上网查了一下,原来我未开启伪静态的模块LoadModule rewrite_module,于是在 apache的配置文件httpd.conf开启了LoadModule rewrite_module,然后再设置固定链接的形式为/%post_id%.html,就可以打开了,自然高兴了,我本地的环境是win+php+apache的;当然为我们提供的服务商一般用的iis服务器的,解决办法是
首先你先问你空间商,你购买的空间支持不支持伪静态,一般购买的付费空间/虚拟主机都是支持的。如果支持的话,就创建一个httpd.ini文件,把下面代码保存到该文件中,上传到网站的根目录就可以了。然后,之后进入WP后台修改固定链接,比如修改为:%/tegory%/%post_id%.html,很简单吧。
代码如下:
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O]
# 3600 = 1 hour</p> <p>CacheClockRate 3600
RepeatLimit 32</p> <p># Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through</p> <p>RewriteRule /tag/(.*) /index.php?tag=$1
RewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /sitemap.xml /sitemap.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]
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O]
# 3600 = 1 hour</p> <p>CacheClockRate 3600
RepeatLimit 32</p> <p># Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through</p> <p>RewriteRule /tag/(.*) /index.php?tag=$1
RewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /sitemap.xml /sitemap.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]
这个规则文件的写法是IIS6.0下最新的wordpress伪静态规则。一般win主机都是IIS6.0的web服务器 ,而不是Apache的,在IIS服务器下,像一些常见的wordpress博客、shopex网店系统等第三方知名第三方程序,伪静态的实现,自己只需要把网站的静态化规则文件命名为httpd.ini文件放在网站根目录就可以了,无须通过网站后台设置,那是在Linux系统下的Apache服务器下才那样设置。
下面这个方法也是从网上找来的,希望和大家一起分享学习了,有什么好的方法一起多多交流了!
标签:WordPress
相关阅读 >>
更多相关阅读请进入《wordpress》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。