繁体   English   中英

将https重定向/重写为http(一页除外)

[英]Redirect / Rewrite https to http except one page

我想将https重定向到除一页以外的http

我需要的:

https://abc.subdomain.com/testing1
https://abc.subdomain.com/testing2
https://abc.subdomain.com/resultant

 http://abc.subdomain.com/testing1
 http://abc.subdomain.com/testing2
 https://abc.subdomain.com/resultant

resultant页面被https击中时,它将保留在https

到目前为止我尝试过的是:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/resultant
RewriteRule ^/resultant https://%{HTTP_HOST}%{REQUEST_URI}/$1 [R=301,L]

但它不会将所有其他页面重定向到http

我的成功代码

#AuthType Basic
#AuthName "sentineldev DEV VERSION"
#AuthUserFile /home/sentineldev/public_html/.htpasswd
#Require valid-user
#ErrorDocument 401 "Unautorized Access"
Options +Indexes -MultiViews
RedirectMatch 403 ^/wp-includes/$
RedirectMatch 403 ^/wp-content/$

#------------------------------


RewriteEngine On

RewriteCond %{HTTPS} on
NRewriteCond %{THE_REQUEST} !/resultant
RewriteRule !^resultant(/.*)?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]



#------------------------------



Header set X-Frame-Options SAMEORIGIN
# Turn on IE8-IE9 XSS prevention tools
Header set X-XSS-Protection "1; mode=block"


# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# 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
<IfModule mod_php5.c>
   php_value upload_max_filesize 2M
   php_value post_max_size 3M
</IfModule>

谢谢

您可以使用:

RewriteEngine On

RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} !/resultant [NC]
RewriteRule !^resultant(/.*)?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,NC]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM