Updating browser URL with ModRewrite?

New to mod_rewrite? This is a good place to start.

Postby Guest » Fri Nov 02, 2001 11:33 am

I am looking for a way of using ModRewrite to strip off the session variables (storing these values in environment variables) out of the original URL and display the URL without these session variables in the browser's URL.

Example:
Original URL: http://www.thisdomain.com&session=1234&newpage=help

Desired URL displayed in Browser:
http://www.thisdomain.com

I have a rule that strips out the variables and stores these values as environmental variables, but the browser URL is not being updated.

Is what I am trying possible using the ModRewrite module?

The existing rule I am using is
RewriteRule ^(.))&session=(.))&newpage-(.)) $1 [E=session:$2,E=newpage:$3]
Guest
 

Postby Brett » Fri Nov 02, 2001 7:44 pm

Actually, mod_rewrite doesn't change what's displayed in the browser window unless the rewriting is done as a redirect. You can accomplish this by including the "http://" in the forward URL or by including "R" in the list of flags. However, in so doing, you may lose your environment variables.

If I'm understanding your situation correctly, the best way to accomplish what you're trying to do is to have the original request submitted as a POST instead of a GET ... which should be possible to arrange, if the requests are coming from your own website.
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com

Postby Guest » Mon Nov 05, 2001 4:37 pm

The only way of submitting a POST method that I am aware of is to create a form, which would not work, because the site requires the session variables for all links on the site. If a user attempts to go to a page on the site without these session variables, they are required to log in again.

Is there another way of using the POST method without a form?
Guest
 

Postby Brett » Mon Nov 05, 2001 5:48 pm

I think you need the form ... but the URL you wrote above suggests to me that you should be able to get away with something like this:
<FORM METHOD=post URL="blahblahblah">
<INPUT TYPE=hidden NAME="session" VALUE=1234>
<INPUT TYPE=hidden NAME="newpage" VALUE="help">
<INPUT TYPE=image SRC="submit.gif">
</FORM>

Or, you could store session variables in a cookie. This is especially easy to do if you're using PHP.

<font size=-1>[ This Message was edited by: Brett on 2001-11-05 20:50 ]</font>
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 27 guests

cron