I’m having some issues with the encryption snippet
My setup:
Unencrypted page:
http://cefabank.com
Encrypted page:
https://preston.eukhost.com/~cefabank
Friendly URLs off (for now, while I figure this out)
Here’s what happens:
Load page
Click to my secure page
Page is redirected correctly to ssl
Click back to unsecure page
Page is redirected incorrectly with ~cefabank/ still in the path
For some reason the page still loads without a problem even though the redirected url is
http://cefabank.com/~cefabank/index.php?id=53
when it should be
http://cefabank.com/index.php?id=53
I suppose this is because of rewrite rules. This would only be a minor annoyance except that when the user goes back to the encrypted page a second time he is redirected to:
http://cefabank.com/~cefabank/~cefabank/index.php?id=188
Which gives a 404 error
A little debugging using echo reveals that on the line
$url = $_SERVER['REQUEST_URI'];
$url is set to /~cefabank/index.php?id=6
So the line
$modx->sendRedirect($unsecureserver.$url);
is redirecting the page to
http://cefabank.com/~cefabank/index.php?id=1. Any ideas? I suppose I could hack the code to remove the ~cefabank from the front of $_SERVER[’REQUEST_URI’] every time but I think there must be a better solution.
my .htaccess is
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ ~cefabank/index.php?q=$1 [L,QSA]
my Enctyption config:
$secureserver = "
https://preston.eukhost.com/~cefabank";
$unsecureserver = "
http://cefabank.com";