question about htaccess and mod rewrite

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:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /connect/users/display [L]
RewriteRule ^$ /connect/users/display [L]
RewriteRule (.*) /connect/users/display/$1 [L]
</IfModule>

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:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /connect/users/display [L,R]
RewriteRule ^$ /connect/users/display [L,R]
RewriteRule (.*) /connect/users/display/$1 [L,R]
</IfModule>

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
davidgregan [ Fr, 25 Januar 2008 21:21 ] [ ID #1916286 ]

Re: question about htaccess and mod rewrite

<davidgregan [at] gmail.com> schreef in bericht
news:33efca90-686c-410c-a7f1-cdd061626e4b [at] u10g2000prn.google groups.com...
> If I use the following:
> <IfModule mod_rewrite.c>
> RewriteEngine on
> RewriteRule ^$ /connect/users/display [L,R]
> RewriteRule ^$ /connect/users/display [L,R]
> RewriteRule (.*) /connect/users/display/$1 [L,R]
> </IfModule>
> 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
HansH [ Fr, 25 Januar 2008 23:58 ] [ ID #1916287 ]

Re: question about htaccess and mod rewrite

> 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
davidgregan [ Sa, 26 Januar 2008 18:22 ] [ ID #1916883 ]
Webserver » alt.apache.configuration » question about htaccess and mod rewrite

Vorheriges Thema: Strange 403 problem with Apache
Nächstes Thema: LDAP authentication / SSL