I have seen this issue sort of addressed here in about 3 posts, but no solution that works so far ...
I am hosting multiple domains on one server/static IP address via mod_rewrite. I always use session variables via cookies, I don't want to put then in a query string for security reasons.
Win 2000
Apache 2.2.3
PHP 5.2.0
- I have added an entry, 127.0.0.1 domain_one, in my hosts file.
- I have created htdocs\domain_one\index.php.
The following works fine in htdocs (localhost), but fails when it gets redirected to htdocs\domain_one. (domain_one)
.htaccess ...
- Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} domain_one$ [NC]
RewriteCond %{REQUEST_URI} !^/domain_one/.*$
RewriteRule ^(.*)$ /domain_one/$1 [L]
\domain_one\index.asp ...
- Code: Select all
<?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?>
<html>
<head>
<title>PHP Session Test</title>
</head>
<body>
Session Id is not preseved... on Refresh or via the link ...<br>
<?php
echo "SESSION ID: " . session_id();
echo "<br><br>count: ". $_SESSION['count'];
echo "<br>";
?>
<br>
<a href="index.php">cycle this page via a link</a>
</body>
</html>
will someone PLEASE tell me what I am doing wrong, or if this can be done at all hehe
<e>edited, discovered 'code' tag, sry, heh </e>