Should PHP header headers be encoded?

Should PHP header headers be encoded?

header("Location: ".$_SERVER["REQUEST_URI"]); header("Location: ".rawurlencode($_SERVER["REQUEST_URI"])); 

If so, why, when and how?

+5
source share
1 answer

You only need to encode it if you have any special characters (defined in RFC1806 ) in your URL. Especially you should encode all URLs with the following characters: {} | \ ^ ~ [] `(with RFC1738)

+1
source

Source: https://habr.com/ru/post/1200121/


All Articles