如何从重写规则中排除特定文件 [英] How to exclude a specific file from a rewriterule

查看:33
本文介绍了如何从重写规则中排除特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这里:如何在htaccess中排除特定文件

在这里:从 .htaccess 中的重写规则中排除文件

但都没有奏效.我可能做错了什么?

but neither worked. What might I be doing wrong?

.htaccess 文件:

.htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-content(/.*|)$ - [L] # don't take any action
RewriteRule ^wp-admin(/.*|)$ - [L] # don't take any action
RewriteRule ^wp-includes(/.*|)$ - [L] # don't take any action
RewriteCond %{REQUEST_URI} !^/pureplantessentials.html$

RewriteRule ^moreinfo/(.*)$ http://www.kgstiles.com/moreinfo$1 [R=301]
RewriteRule ^healthsolutions/(.*)$ http://www.kgstiles.com/healthsolutions$1 [R=301]
RewriteRule ^(.*).html$ $1/ [R=301]
RewriteRule ^(.*).htm$ $1/ [R=301]
</IfModule>

推荐答案

要排除文件,请尝试以下操作:

To exclude a file, try something like this:

RewriteCond %{REQUEST_URI} !^/pureplantessentials.html$ 

如果文件是pureplantessentials.html,将跳过该规则.

The rule will be skipped if the file is pureplantessentials.html.

这篇关于如何从重写规则中排除特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆