This useful article shows you what parts of a URL you can build with .htaccess server enviromental variables.
http://www.quantumwarp.com:8080/subfolder/subfolder2/index.php?turnip=51 1 2 3 4 5 6 - $_SERVER['SERVER_NAME']; 2-3 (port number is not included) - $_SERVER['REQUEST_URI']; 3-6 - $_SERVER['QUERY_STRING']; 5-6 (? is not included) - $_SERVER['HTTP_HOST']; 2-3 - $_SERVER['HTTPS']; This is a Boolean for HTTPS - $_SERVER['SCRIPT_NAME']; 2-5 - $_SERVER['PHP_SELF']; 2-5
- Anatomy of a URL - very useful article on this subject.