繁体   English   中英

将所有https重定向到http,除了3页[htaccess / php]

[英]Redirect all https to http, except 3 pages [htaccess / php]

运行wordpress网站,因此它已经有其自己的规则,以从链接中删除index.php。 此外,每次在URL中都有“ cache_img”时,都会应用特定的规则。

我需要的:

  1. 使当前规则继续有效
  2. 如果网址位于https中,请用http(301)重写,除3页外(bookingstep1,bookingstep2,bookingsep3)

我很讨厌htaccess,对我来说这几乎没有意义,我希望有人可以帮助我。 我对htaccess或php解决方案持开放态度。

这就是我目前所拥有的(并且可能已经有错误...)

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(cache_img) [NC]
RewriteRule . /index.php [L]
RewriteRule ^cache_img/(.*)x(.*)-(.*)/r/(.*) cache_img/tt.php?src=http://mydomain.com/$4&w=$1&h=$2&zc=$3&q=100

我尝试在htaccess的顶部添加:

RewriteCond %{HTTPS} on
Rewritecond %{REQUEST_URI} !^bookingstep(1|2|3)\/?$ [NC]
RewriteRule ^(.*) http://mydomain.com/$1 [R=301,L]

适用于所有页面...删除https并用http重写。 但是它也会重写bookinstep *页面:(

请帮忙! 谢谢!

尝试一下此插件:

http://wordpress.org/plugins/wordpress-https

我一直都在使用它。 您可以将每个页面都设为https,也可以进入各个页面/帖子,然后仅将其单独设置为安全。

编辑

RewriteEngine on
RewriteCond %{SERVER_PORT} =80
RewriteRule ^bookingstep1/?$ https://URL HERE/bookingstep1[R=301,QSA,L,NE]
RewriteRule ^bookingstep2/?$ https://URL HERE/bookingstep2[R=301,QSA,L,NE]
RewriteRule ^bookingstep3/?$ https://URL HERE/bookingstep3[R=301,QSA,L,NE]

将所有https重定向到http

码:

RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} on
RewriteRule  ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

有关更多详细信息,请参见此处

暂无
暂无

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

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