question about htaccess and mod rewrite

question about htaccess and mod rewrite

am 25.01.2008 21:21:44 von davidgregan

I'm trying to use a redirect to a login page with .htaccess and I'm
having problems. Here is the .htaccess file in the directory that I
want to password protect:


RewriteEngine on
RewriteRule ^$ /connect/users/display [L]
RewriteRule ^$ /connect/users/display [L]
RewriteRule (.*) /connect/users/display/$1 [L]


the URL stays the same while it redirects, which I like, however, the
page I redirect to cannot read the session data. If I use the
following:


RewriteEngine on
RewriteRule ^$ /connect/users/display [L,R]
RewriteRule ^$ /connect/users/display [L,R]
RewriteRule (.*) /connect/users/display/$1 [L,R]


The page redirects and the destination page can read the session data.
However, the URL changes in the address bar. Why is this happening? Is
there anyway I can get the best of both worlds?

Thanks,
Dave

Re: question about htaccess and mod rewrite

am 25.01.2008 23:58:18 von HansH

schreef in bericht
news:33efca90-686c-410c-a7f1-cdd061626e4b@u10g2000prn.google groups.com...
> If I use the following:
>
> RewriteEngine on
> RewriteRule ^$ /connect/users/display [L,R]
> RewriteRule ^$ /connect/users/display [L,R]
> RewriteRule (.*) /connect/users/display/$1 [L,R]
>

> The page redirects and the destination page can read the session data.
> However, the URL changes in the address bar. Why is this happening?
The R makes Apache tell the browser to try again on the new URL

> Is there anyway I can get the best of both worlds?
How do you transfer session data: cookie, query string or ...
If query string try [L,QSA]

BTW Why are first and second rule identical ??

HansH

Re: question about htaccess and mod rewrite

am 26.01.2008 18:22:20 von davidgregan

> How do you transfer session data: cookie, query string or ...
> If query string try [L,QSA]

Thanks!

> BTW Why are first and second rule identical ??

I wanted to make extra sure that the page was redirected... Just
kidding, I'm really not sure how that ended up in there twice. Thanks
for pointing it out

Dave

thanks