Example my current URL is
http://domain.com/category/health-beauty/?s开发者_如何学Cession={%22session_key%22%3A%22df1eca3f79e122bd915651e5-1325102496%22%2C%22uid%22%3A%221325102496%22%2C%22expires%22%3A0%2C%22secret%22%3A%229eb858d1fc7dda2b37be912282a41382%22%2C%22base_domain%22%3A%22domain.com%22%2C%22access_token%22%3A%22193986783965592|df1eca3f79e122bd915651e5-1325102496|nJe_UcyAxMt2i6S40QWBKw6-Rek%22%2C%22sig%22%3A%22a7304578c9e00c14ed8e5825e2c2837b%22}
The session
is coming from Facebook.
Now I want remove or refresh the current URL to be
http://domain.com/category/health-beauty/
Let me know.
The following will strip out the query string from the url and refresh the page
if(window.location.indexOf('?') > -1) {
window.location = window.location.substr(0, window.location.indexOf('?'));
}
Also if you want to do this in php
$uri = $_SERVER['REQUEST_URI'];
if(strpos($uri, '?') !== false) {
header('location: '.substr($uri, 0, strpos($uri, '?')));
}
Do you want to keep the session variable? If not you can just use the header function:
header('http://domain.com/category/health-beauty/');
Have you looked at the PHP Server and Environment variables?
Server: http://www.php.net/manual/en/reserved.variables.server.php
Environment: http://www.php.net/manual/en/reserved.variables.environment.php
With your URL "http://domain.com/category/health-beauty/?session=..." they should contain something like this:
$_SERVER["SERVER_NAME"]: domain.com
$_SERVER["SCRIPT_NAME"]: /category/health-beauty/
$_SERVER["PHP_SELF"]: /category/health-beauty/
$_ENV["SERVER_NAME"]: domain.com
$_ENV["SCRIPT_NAME"]: /category/health-beauty/
If you want to check all these variables and alot more, put <?php phpinfo(); ?>
in a file op your domain and open it... You will be able to find just the right variables for your need!
精彩评论