[英]Redirect all https to http, except 3 pages [htaccess / php]
Running a wordpress site, therefore it already has its own rule to remove index.php from links. 运行wordpress网站,因此它已经有其自己的规则,以从链接中删除index.php。 Furthermore, every time in a url there is "cache_img", a specific rule applies. 此外,每次在URL中都有“ cache_img”时,都会应用特定的规则。
What I need: 我需要的:
I suck at htaccess, it makes little to no sense to me, I hope someone can help me with this. 我很讨厌htaccess,对我来说这几乎没有意义,我希望有人可以帮助我。 I'm open to either htaccess or php solutions. 我对htaccess或php解决方案持开放态度。
This is what I have at the moment (and it may already have mistakes in it...) 这就是我目前所拥有的(并且可能已经有错误...)
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
I tried with adding at the top of my htaccess: 我尝试在htaccess的顶部添加:
RewriteCond %{HTTPS} on
Rewritecond %{REQUEST_URI} !^bookingstep(1|2|3)\/?$ [NC]
RewriteRule ^(.*) http://mydomain.com/$1 [R=301,L]
Which works for all pages... it removes the https and rewrites them with http. 适用于所有页面...删除https并用http重写。 But it also rewrite the bookinstep* pages :( 但是它也会重写bookinstep *页面:(
Please help! 请帮忙! Thank you! 谢谢!
Give this plugin a go: 尝试一下此插件:
http://wordpress.org/plugins/wordpress-https http://wordpress.org/plugins/wordpress-https
I personally use it all of the time. 我一直都在使用它。 You can make every page https or can go into individual pages/posts and just make those individually secure. 您可以将每个页面都设为https,也可以进入各个页面/帖子,然后仅将其单独设置为安全。
EDIT 编辑
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]
Redirect all https
to http
将所有https
重定向到http
Code: 码:
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.