Set Environment Variables According To URL

FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Set Environment Variables According To URL

Perhaps you want to keep status information between requests and use the URL to encode it. But you don’t want to use a CGI wrapper for all pages just to strip out this information.


Environment Variable Solution

We use a rewrite rule to strip out the status information and remember it via an environment variable which can be later dereferenced from within XSSI or CGI. This way a URL /foo/S=java/bar/ gets translated to /foo/bar/ and the environment variable named STATUS is set to the value “java”.

RewriteEngine On
RewriteBase /
RewriteRule   ^(.*)/S=([^/]+)/(.*)$1/$3 [E=STATUS:$2]

From: Set Environment Variables According to URL


«
»

Add Your Opinion

No comments yet. Be the first!


It's very simple - you read the protocol and write the code. -Bill Joy

HTML | DCMI | GRDDL | XOXO | XDMP | XFN | DOM | XML | XHTML 1.1 Strict | CSS 2.1 | W3C | TLDP | WAI | DISA | ICSI | GIAC | SANS RR | GHOST | DEFCON | NIST | DHS CYBER | NIST

↑ TOPExcept where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. HTTPD based on NCSA HTTPd

Site Map | Contact Webmaster | Email AskApache | Glossary | License and Disclaimer | Terms of Service