RewriteRule is breaking $_SESSION

ailen

New Member
Everything was working fine till I added my .htaccess file. What I'm trying to do is route all my users to their profile page. So www.darudude.com/user1 routes to www.darudude.com/userinfo.php?user=user1My .htaccess file as this:\[code\]RewriteEngine onRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)\?*$ userinfo.php?user=$1 [L,QSA]\[/code\]However ever since I added this, it breaks my sessions. On every page I have a initialize a session, and the sessions stores the referrer. This is the piece of code that handles the important part.\[code\]if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url'];}else{ $this->referrer = "/index.php";}//this echo is used to debug why this thing isn't working!!echo "<script>alert('".$this->referrer."');</script>";/* Set current url */$this->url = $_SESSION['url'] = $_SERVER['PHP_SELF'];\[/code\]and then I'm returned to the original page using this piece of code:\[code\]header("Location: ".$session->referrer);\[/code\]So for example, without the .htaccess file, if I login through one of the pages everything works and I get redirected back to the page I logged in from (i.e. if I logged in from index.php I get redirected back to index.php; if faq.php, I get redirected back to faq.php). With the .htaccess file I keep getting sent to /userinfo.php leading me to thing its something wrong with my rewriteruleThis is how its supposed to work:index.php loads. the $_SESSION['url'] is set to index.php
a login form is enacted whos action redirects to process.php
process.php the $session->referrer is set from $_SESSION['url']
After the login is confirmed the page should redirect using: header("Location: ".$session->referrer); This is how it worked originally without any problems.However, after the .htaccess was created it seems to redirect me to userinfo.php. I think it has something to do with my rule. Any ideas?
 
Back
Top