Der Serverknecht

Forum Home

All times are GMT +2. The time now is 23:57.

Go Back   Serverknecht Forum > - = Usenet - alt.* = - > alt.apache.configuration
User Name:
Password:
FAQ English/Englisch (US) German/Deutsch (Du) German/Deutsch (Sie) Members List Calendar Search Today's Posts Mark Forums Read


 
 
Thread Tools Search this Thread Display Modes
Old 08-03-2007, 14:26   #1
tasteless
Usenet Poster
 
Posts: n/a
Default Apahce +htaccess +url rewrite +session id


Hi all,

I trying to make a rule for htaccess (apache with mod_rewrite) for
rewriting URL and take out the session_id from there, now for example I
have:

http://www.example.com/view/account...ss=fcac4228c5450d5a9f773c21dd677089


Name of variable is 'sess' and it's always as a last variable in URL
string, so I've create rule but it's doesn't work in all:

RewriteEngine On
RewriteRule ^(\sess=\.*)$ http://localhost/$1? [R=301,L]

I'd like to trim the session id from url and make it like this:

http://www.example.com/view/account.php

So - any ideas ? Many Thanks for any hints.

--
Silly is a state of Mind, Stupid is a way of Life
Regards - tasteless - not always but sometimes...
 
Old 08-03-2007, 14:35   #2
Rik
Usenet Poster
 
Posts: n/a
Default Re: Apahce +htaccess +url rewrite +session id

tasteless <tasteless@gazeta.pl> wrote:

> Hi all,
>
> I trying to make a rule for htaccess (apache with mod_rewrite) for
> rewriting URL and take out the session_id from there, now for example I
> have:
>
> http://www.example.com/view/account...ss=fcac4228c5450d5a9f773c21dd677089
> Name of variable is 'sess' and it's always as a last variable in URL
> string, so I've create rule but it's doesn't work in all:
>
> RewriteEngine On
> RewriteRule ^(\sess=\.*)$ http://localhost/$1? [R=301,L]
>
> I'd like to trim the session id from url and make it like this:
>
> http://www.example.com/view/account.php


I'm not entirely clear on what you intend to do, something like this?

RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)sess=
RewriteRule (.*?) http://%{HTTP_HOST}/$1 [R=301,L]

--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
 
Old 08-03-2007, 14:39   #3
tasteless
Usenet Poster
 
Posts: n/a
Default Re: Apahce +htaccess +url rewrite +session id

Rik wrote:

> I'm not entirely clear on what you intend to do, something like this?
>
> RewriteEngine On
> RewriteCond %{QUERY_STRING} (^|&)sess=
> RewriteRule (.*?) http://%{HTTP_HOST}/$1 [R=301,L]


Basically I need to remove (overwrite) this variable - 'sess' with value
(which is session id) from URL address.

ATM I have:

http://192.168.254.130/index2.php?sess=fcac4228c5450d5a9f773c21dd677089

I need:

http://192.168.254.130/index2.php

Your rule is very close to my point, but the effect is following:

http://192.168.254.130/?sess=fcac4228c5450d5a9f773c21dd677089

Many thanks anyway :)

--
Silly is a state of Mind, Stupid is a way of Life.
Regards - tasteless - not always but sometimes...
 
Old 08-03-2007, 15:03   #4
Jim Carlock
Usenet Poster
 
Posts: n/a
Default Re: Apahce +htaccess +url rewrite +session id

"tasteless" <tasteless@gazeta.pl> posted...
: Basically I need to remove (overwrite) this variable - 'sess' with
: value (which is session id) from URL address.
:
: ATM I have:
:
: http://192.168.254.130/index2.php?sess=fcac4228c5450d5a9f773c21dd677089
:
: I need:
:
: http://192.168.254.130/index2.php
:
: Your rule is very close to my point, but the effect is following:
:
: http://192.168.254.130/?sess=fcac4228c5450d5a9f773c21dd677089

Perhaps use PHP to store the session variables inside a POST Form
instead of a GET Form. I think PHP automatically generates GET
Forms (which places the session variables in the address bar). And
perhaps you can get around it by hand creating the Form in HTML
code and use method="post" to get it out of the address bar. Take
a look at the source code on your page through your web-browser
and you'll see the code that PHP automatically generates for the
session variables.

??

--
Jim Carlock
Post replies to the group.


 
Old 08-03-2007, 15:58   #5
Rik
Usenet Poster
 
Posts: n/a
Default Re: Apahce +htaccess +url rewrite +session id

Jim Carlock <anonymous@127.0.0.1> wrote:

> "tasteless" <tasteless@gazeta.pl> posted...
> : Basically I need to remove (overwrite) this variable - 'sess' with
> : value (which is session id) from URL address.
> :
> : ATM I have:
> :
> : http://192.168.254.130/index2.php?sess=fcac4228c5450d5a9f773c21dd677089
> :
> : I need:
> :
> : http://192.168.254.130/index2.php
> :
> : Your rule is very close to my point, but the effect is following:
> :
> : http://192.168.254.130/?sess=fcac4228c5450d5a9f773c21dd677089
>
> Perhaps use PHP to store the session variables inside a POST Form
> instead of a GET Form. I think PHP automatically generates GET
> Forms (which places the session variables in the address bar). And
> perhaps you can get around it by hand creating the Form in HTML
> code and use method="post" to get it out of the address bar. Take
> a look at the source code on your page through your web-browser
> and you'll see the code that PHP automatically generates for the
> session variables.


If PHP does something to the url you don't like with sessions, it uses
url_rewriter_tags. If this is based on the php sessions, you might want to
set session.use_only_cookies or something like that to true

--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
 
Old 08-03-2007, 16:14   #6
tasteless
Usenet Poster
 
Posts: n/a
Default Re: Apahce +htaccess +url rewrite +session id

Rik wrote:

> If PHP does something to the url you don't like with sessions, it uses
> url_rewriter_tags. If this is based on the php sessions, you might want
> to set session.use_only_cookies or something like that to true


This is existing website based on OSCommerce script (old 2.2 version - I
can't change it) - there is lot's of changes inside the code madded by
someone else, if I take out the session id from URL the sessesion will
be dropped - so I want to rewrite URL and send session id informations
somewhere in the background - but I'm not sure if mod_rewrite can do this.

The current code is very doggy and there is big chaos - I trying to deal
with that - but without any result ATM :/

--
Silly is a state of Mind, Stupid is a way of Life
Regards - tasteless - not always but sometimes...
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
why use session id in URL? crescent_au@yahoo.com alt.php 6 29-11-2006 02:00
why use session id in URL? crescent_au@yahoo.com comp.lang.php 7 29-11-2006 02:00
Rewrite Rules Problem (quickie) (htaccess) frizzle alt.apache.configuration 0 27-05-2006 15:56
URL rewriting and proxying Bob alt.apache.configuration 11 21-05-2006 03:51
htaccess auf url Markus Seeberger de.comm.software.webserver 5 19-11-2004 21:59


Forum Home

Copyright 2004 - 2014, IT Services Henry Skrypek
vBulletin Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Page generated in 0.06231 seconds (62.44% PHP - 37.56% MySQL) with 11 queries

Der Serverknecht PageCounter