我正在尝试使用.htaccess将我网站上的一个页面redirect到https对应的页面。 checkout.php页面位于网站的根目录/ html文件夹中。 (/checkout.php)。 我试过使用这个:(我在网上find的地方)。 我把它,并得到了内部服务器错误。
RewriteEngine On RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !checkout.php RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
这个想法是,如果一个客户在checkout.php页面,然后redirect到https …如果他们不是,redirect到http。 任何帮助都是极好的。
这里的重写代码我用来redirect普通http的WordPress的pipe理页面访问到https。 您可以根据自己的需求进行定制。
RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^wp-admin https://www.example.com/wp-admin [R=301,L]