• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 58
  • Last Modified:

htaccess rewriterules cookies

I want to understand how cookies crumble with rewriterules
example below:

RewriteEngine On
RewriteRule ^index\.php - [CO=frontdoor:yes:.example.com:1440:/]
1.
if I resides .htaccess file with the code into the root directory e.g. http://localhost/ (or Applications/AMPPS/www) and access http://localhost/index.php with following code :

<?php
session_start();

echo $_SESSION['frontdoor'];

if(!isset($_COOKIE['frontdoor'])) {
    echo "Cookie named '" . $cookie_name . "' is not set!";
} else {
    echo "Cookie '" . $cookie_name . "' is set!<br>";
    echo "Value is: " . $_COOKIE[$cookie_name];
}
?>

I do not see any cookie named frontdoor ,

2. if I change domain name .example.com with localhost ? though no luck yet ,
I found very little documentation about it over internet , http://httpd.apache.org/docs/2.4/rewrite/flags.html seems a bit too little .
0
Amit Kumar
Asked:
Amit Kumar
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
What browser are you using?  Chrome will not accept a cookie on 'localhost'.  You have to be at least using the machine IP address if not a domain name.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now