2

我正在尝试使用 htaccess 将我的页面重定向到 https。同时我希望其他页面应该在 http 上工作。以下是我的 .htaccess 代码。

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

# Turn SSL on for index.php
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} \/trimmApp\/index\.php [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L]

# Turn SSL off everything exluding index.php (and some files used on index.php that need to serve through https only)

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} !\/trimmApp\/index\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L]

Http 到 https 的重定向发生得很好,但是,htpps 重定向到另一个https://index.php并且这种情况无限期地发生。我尝试了几乎所有可能的 wrt httpd.cong AllowOveride 设置,

以下是我的重写日志的快照:

10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='80' pattern='!^443$' => matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='/check/ping.html' pattern='\/trimmApp\/index\.php' [NC] => not-matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/check/ping.html -> check/ping.html
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (3) [perdir /var/www/] applying pattern '^(.*)$' to uri 'check/ping.html'
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='80' pattern='=443' => not-matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70]

不确定必须发生什么。帮助将不胜感激。我的 linux 版本是 Centos 5.6

4

0 回答 0