How to hide parameters (query_string) in url but send them to page hidden, not visible in address bar
example:
I have this:
http://localhost/index.php?sent=true
i want:
http://localhost/index.php
but i want to get sent parameter in PHP $_GET[‘sent’]
i tried to redirect to page with no parameters(no query_string) [R] and after that give page some parameters (silently) without [R] redirection (without changing adress itself)
i tried to use RewriteRule in htaccess with different flags and different ways but nothing worked
i learned that if i want to change address in browser, i must use R flag with L flag in one RewriteRule line – other way it does not work – adress does not change
but when i use [L] flag i cannot go to next line(next RewriteRule) and append any query_string to address without [R] redirection
if i don’t put an [L] flag in first line (with [R]) i don’t have new address but if i do – i can’t use [C] flag or even [N] flag
Here is why:
on my page i use header(‘Location: …?sent=true’) function after successful data sent from Form
i redirect to ?sent=true because of i don’t want to user refresh page and send the same data again
but after redirect to ?sent=true i don’t want to have that query_string in address bar
there are more forms on that page that will send other POST data and refresh page with this ugly query_string there
how to do that?
You could just set it so that if you visit a script with
?sent=trueonce it has finished, it redirects the usere.g.
You can’t do this with htaccess as you need to pass to PHP, it’s passed to PHP after redirection so if you redirect with htaccess the value will never get to PHP.
Further question, the only way to do this then is to redirect the user with a javascript form