0

Based on htaccess 301 redirect - Remove query string (QSA)

RewriteCond %{QUERY_STRING} ^(hash)=([^-\/]{32})$
RewriteRule . %{REQUEST_URI}? [E=HASH:%2,R=301,L]

In the below case ENV:HASH is not redirected.

How to store the query string content as an environment variable before removing it from the url?

Community
  • 1
  • 1
RafaSashi
  • 16,483
  • 8
  • 84
  • 94
  • 2
    An environment variable cannot be saved between two requests afaik. When you send a redirect a 301 header, the browser does a new request to the server with the new url. You could possibly store the hash in a cookie if you really want to redirect. – Sumurai8 Jun 18 '14 at 16:50
  • @Sumurai8 thanks! And is it possible to keep track on the referer after a 301 redirection? – RafaSashi Jun 18 '14 at 17:02
  • 1
    As indicated by @Sumurai8 you can store whatever information you want in a cookie and retrieve it later. `%{HTTP_REFERER}` may get lost in redirection. – anubhava Jun 18 '14 at 19:18
  • store with Header set Set-Cookie? – RafaSashi Jun 19 '14 at 14:32

0 Answers0