wordpress通过安装ISAPI_Rewrite组件配置httpd.ini的伪静态规则:
# Defend your computer from some worm attacks
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule /tag/(.*) /index\.php\?tag=$1
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /robots.txt /robots.txt [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]
根据提示# Defend your computer from some worm attacks
意思是为了抵御部分如蠕虫病毒进攻,所以把非 WordPress 文件设置为无法打开。
如果想打开某个文件只要在下面添加一条 RewriteRule 就能让你需要的文件正常访问
举个例子: 比如上传一个页面test.php,现在wordpress做好伪静态了,但是test.php无法访问,访问就直接跳到404了,
那伪静态规则文件里的代码就可以加入这样一行代码:RewriteRule /test.php /test.php [L]
# Defend your computer from some worm attacks
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule /tag/(.*) /index\.php\?tag=$1
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /robots.txt /robots.txt [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
RewriteRule /test.php /test.php [L]
RewriteRule /文件名 /文件名 [L]
RewriteRule /文件名 /文件名 [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]
把代码改成想打开的那个文件的文件名就可以了 有多个文件需要打开,就添加多条
- THE END -
最后修改:2022年12月16日
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://www.jaaai.com/65.html
共有 0 条评论