在过去的几个小时(天),我一直有一些麻烦,重定向到 页。htaccess重定向到SSL
我的设置如下:我有在Debian在Apache 2.2.16的电子商务网站 以下的.htaccess(所有需要MODS启用)
RewriteEngine On
RewriteBase /shop
RewriteCond $1 !^(index\.php|products|img|theme\.php|checkout\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]
所有请求传递给指数。 PHP的作为我的控制器,并包括 其他.php文件的必要。
我现在想用HTTPS在结账过程,是一个PHP脚本 巧妙地称为checkout.php
我认为这将是为改变我的.htaccess为简单:
RewriteEngine On
RewriteBase /shop
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{SERVER_URI} checkout\.php
RewriteRule ^checkout.php?/$1 https://localhost/shop/checkout.php?/$1 [L,R]
RewriteCond $1 !^(index\.php|products|img|theme\.php|checkout\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]
所以checkout.php不会被index.php处理。显然它并不是那么简单。我可以通过使用硬编码的 https链接来结账,但我更愿意使用mod_rewrite来完成。 如果任何人都可以分享一些 洞察力,这将非常感激。
在此先感谢
而不是检查%{SERVER_PORT}尝试检查%{HTTPS} –