-1

I am redirecting page using PHP header location:

Current URL in browser

 https://mywebsite/open/firstpage/php/start.php?&cnt=us&language=en&url=http://secureURL.com

but want to show

https://mywebsite/open/firstpage/php/start.php?&cnt=us&language=en

I am using GET method on the other side to collect all variables. I have to hide &url in querystring but want to receive it on other side $_GET['url']

How can I share my &url without showing in URL querystring? HOw can I write htaccess?

Mangesh Sathe
  • 1,987
  • 4
  • 21
  • 40

2 Answers2

2

Redirect for all URLs

RewriteEngine on
RewriteRule ^(.*) $1?%{QUERY_STRING}&url=http://secureURL.com [L]

Redirect for only /open/firstpage/php/start.php

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/open/firstpage/php/start.php
RewriteRule ^(.*) $1?%{QUERY_STRING}&url=http://secureURL.com [L]

I think this is what you want.

Rijul Sudhir
  • 2,064
  • 1
  • 15
  • 19
1

You can't do that. If a parameter is not present in the query string, it won't be available anywhere, it's just not there. There's no such thing as "hiding" the query string.

You could, however, use some form of session mechanism to pass a piece of data from one page to another. You could put it in the $_SESSION, or use cookies. There may also be a way to achieve this through really arcane mod_rewrite magic, but you shouldn't go down that route. Really.

More importantly: what are you trying to achieve? Why are you trying to do this?

Aesthetic reasons? Then be aware that modern browsers tend to hide the query string part of the URI from the user.

Security reasons? Then you're doing it horribly wrong, you shouldn't use something so easily manipulated by the client.

User tracking? There are established solutions out there for that (say, Google Analytics).

SáT
  • 3,633
  • 2
  • 33
  • 51
  • I am now applying Security salt, I will share it with thirdt paarty they will check RSA on it. Finally both hash values should be same – Mangesh Sathe Apr 28 '16 at 11:38