Apache mod_rewrite - How to hide $_GET vars from url
When I call the page
http://localhost/books-123-name.html?language_id=1
to appear in the browser th开发者_C百科e following link:
http://localhost/books-123-name.html
but will keep the value language_id=1
How can this be done?
Thanks.
There are several ways to store information about requests other than GET parameters. One is using cookies, and you could store language_id in a cookie. A special case of using cookies would be using a session. You could also pass the language_id in a POST request, because POST parameters are invisible to the user. You might also use mod_rewrite to still use GET parameters, but make them prettier.
In short, you can't.
The browser needs those values there in order to read them.
You could try reading them in, doing something with them and then redirecting to a page without the parameters.
Or use POST
.
But more importantly, why?
Like jakenoble said use POST
.
Or Maybe you can use a different url pattern like
http://localhost/{human-readable-language}/books-123-name.html
e.g. http://localhost/en/books-123-name.html
to
http://localhost/books-123-name.html?language_id={languade-id}
e.g. http://localhost/books-123-name.html?language_id=1
精彩评论