本人用的是win主机iis6,搭wordpress伪静态可算是费了不少了功夫。
以前也在网上查了很多的方法,有的有效有的没有效果。
最后也不晓得是在哪儿找的教程了,修改了根目录下的httpd.ini文件。
我的http.ini文件内容:
| [ISAPI_Rewrite] # Defend your computer from some worm attacks #RewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # Rules to ensure that normal content gets through RewriteRule /software-files/(.*) /software-files/$1 [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] # BEGIN WordPress RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress # =====ISAPI_Rewrite 2.x==== RewriteCond Host: ^reach-english.com$ RewriteRule (.*) http://www.reach-english.com$1 [I,RP] # =====ISAPI_Rewrite 3.x==== RewriteCond %{HTTP:Host} ^reach-english.com$ RewriteRule (.*) http://www.reach-english.com$1 [NC,R=301] |
复制以上代码另存为http.ini文件,上传到网站跟目录,刷新主机。
注意:要刷新主机,刷新以后这段代码才会生效。(可能跟安装一些程序后要重启电脑才能正常运行一样)
你会发现,你的伪静态,随你怎么改。
由于WP有404页面功能,导致代码生效后很多子目录不能直接http//***/***/访问。
请修改第10行代码,
| RewriteRule /software-files/(.*) /software-files/$1 [L] |
/software-files/ 即你想访问的目录,修改后即可访问,注意地址是http://****/***/
后面的“/”一定要加上,不然访问的依然是index.php,将进入404页面。
好了就这些,供大家参考,欢迎指证。
