Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 停止htaccess中的某些文件重定向_Apache_.htaccess_Redirect_Mod Rewrite - Fatal编程技术网

Apache 停止htaccess中的某些文件重定向

Apache 停止htaccess中的某些文件重定向,apache,.htaccess,redirect,mod-rewrite,Apache,.htaccess,Redirect,Mod Rewrite,有人能告诉我如何修改我的.htaccess文件以不重定向.txt文件吗 .htaccess文件将所有内容从http重定向到https,但我想从重定向中排除任何.txt文件 这是我的.htaccess文件的当前内容: # BEGIN Really_Simple_SSL_HSTS <IfModule mod_headers.c> Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; p

有人能告诉我如何修改我的
.htaccess
文件以不重定向
.txt
文件吗

.htaccess
文件将所有内容从
http
重定向到
https
,但我想从重定向中排除任何
.txt
文件

这是我的
.htaccess
文件的当前内容:

# BEGIN Really_Simple_SSL_HSTS
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=63072000;     includeSubDomains; preload" env=HTTPS
Header always set Cache-Control "no-store, no-cache, must-revalidate"
</IfModule>
# END Really_Simple_SSL_HSTS

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.5.20]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
#真正开始_简单_SSL_HSTS
标头设置严格的传输安全性“max age=63072000;includeSubDomains;preload”env=HTTPS
标头始终设置缓存控制“无存储,无缓存,必须重新验证”
#结束真正的\u简单\u SSL \u HST
#开始RLRSSSLREALLYSPLESSL rsssl_版本[2.5.20]
重新启动发动机
重写cond%{HTTPS}=关于[NC]
重写规则^(.*)$https://%{HTTP_HOST}%{REQUEST_URI}[R=301,L]
#结束rlrssslReallySimpleSSL
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

尝试向重写添加另一个条件:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} !=on [NC]
  RewriteCond %{REQUEST_URI} !^.*\.txt$
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule> 

重新启动发动机
重写cond%{HTTPS}=关于[NC]
重写条件%{REQUEST_URI}!^.*\。文本$
重写规则^(.*)$https://%{HTTP_HOST}%{REQUEST_URI}[R=301,L]

尽管您可能希望确保URL不以
.txt
结尾,而不仅仅是不包含
.txt
。例如,
!\。txt$
。在
RewriteRule
模式中执行此操作,而不是使用额外的
RewriteCond
指令,效率会稍微高一些。例如,
重写规则!\。txt$https://....