.htaccess &WordPress:从 RewriteRule 中排除文件夹 [英] .htaccess & WordPress: Exclude folder from RewriteRule

查看:35
本文介绍了.htaccess &WordPress:从 RewriteRule 中排除文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 WordPress 中有这个 .htaccess 文件.它位于/public_html/(网络根目录).我需要从重写引擎中排除一个文件夹 (csNewsAd).我已经尝试过这个,基于另一个与 SO 类似的问题,但根本没有用.

I have this .htaccess file in WordPress. It's located at /public_html/ (web root). I need to exclude a folder (csNewsAd) from the rewrite engine. I've tried this, based from another question similar here at SO, but didn't work at all.

AddHandler x-httpd-php5 .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/csNewsAd($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

有什么建议吗?

/csNewsAd 中还有另一个 .htaccess 用于密码保护:

There's another .htaccess inside /csNewsAd for password protection:


AuthName "Clasificados"
AuthType "basic"
AuthUserFile /home/ig000192/public_html/csNewsAd/.passwd
Require valid-user

推荐答案

RewriteCond %{REQUEST_URI} !^/(csNewsAd|csNewsAd/.*)$ 

代替

RewriteRule ^/csNewsAd($|/) - [L] 

这篇关于.htaccess &amp;WordPress:从 RewriteRule 中排除文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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