0

drupal で実行しているサイトがあります。サーバーは https 対応です。ここで、次のようないくつかのページを除いて、すべてのページを htp で実行したいと考えています。

http://www.mysite.com/

http://www.mysite.com/tour.html

http://www.mysite.com/contact-us.html

例外

https://www.mysite.com/buynow.html

https://www.mysite.com/signup.html

.htaccess を使用したり、任意のモジュールをインストールしたりして、これを行うにはどうすればよいですか?

前もって感謝します!

4

2 に答える 2

0

buynow.html または signup.html を要求したときに、人々を https にリダイレクトしたいとします。他のページでは、http を使用する必要があります。この .htaccess を試してください:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} (^/buynow.html)|(^/signup.html)
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L]


RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/buynow.html
RewriteCond %{REQUEST_URI} !^/signup.html
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [L]

アップデート

新しい .htaccess:

<IfModule mod_rewrite.c>
      RewriteEngine on

      RewriteRule (.*) $1 [E=protossl]
      RewriteCond %{HTTPS} on
      RewriteRule (.*) $1 [E=protossl:s]

      RewriteRule "(^|/)\." - [F]

      RewriteCond %{HTTP_HOST} .
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

      RewriteCond %{HTTPS} !=on
      RewriteCond %{REQUEST_URI} (^/buynow.html)|(^/signup.html)
      RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L]

      RewriteCond %{HTTPS} on
      RewriteCond %{REQUEST_URI} !^/buynow.html
      RewriteCond %{REQUEST_URI} !^/signup.html
      RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [L]

      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^ index.php [L]
</IfModule>
于 2013-07-27T07:41:50.117 に答える