[ Published on -
Few years ago I was working in "sterile" web environment where only allowed server side technology was SSI - Server Side Includes.
I needed to extract parts from URL and based on those parts to dynamically generate links.
Simple example would be extracting language part from url and than using it for creating page links:
Url:
http://www.stasha.info/blog/en/somepage.html
generating links:
http://www.stasha.info/blog/en/somepage2.html
http://www.stasha.info/blog/en/somepage3.html
And here is SSI code for extracting language part:
<!--#exec cmd="echo $DOCUMENT_URI | sed -e 's/.*\/blog\/\([^/]*\).*/\1/'" -->
By modifying regexp in SSI, you can extract any part from url.