PHP: clean urls and query strings -


why isn't query string added array when using clean urls? eg. using /foo/bar?stack=overflow , $_get['stack'] variable empty.

i'm implementing clean urls code:

$request = rawurldecode($_server['request_uri']); // extracts index.php file path (eg. /my_app) // there no need specify path index.php script handles $path_to_index = str_ireplace($_server['document_root'].'/', '', $_server['script_filename']); $path_to_index = str_ireplace('/'.basename($_server['script_filename']), '', $path_to_index); // rid of path index.php $request = str_ireplace($path_to_index, '', $request); // rid of index.php in url $request = str_ireplace(basename($_server['script_filename']), '', $request); // our url clean can explode $request = explode('/', $request); // delete empty , reindex $request = array_values(array_filter($request)); 

if using rewriterules in .htaccess

at end of rewriterule line put [qsa] this:

rewriterule (.*) index.php?stuff=$1 [qsa] 

qsa flag info: http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_qsa


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -