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://....