相対URLを渡してheader
も問題ありません。
header("Location: /route/here.php");
完全に合法です。RFC では、スキーマを含む絶対 URL を指定する必要があります。一部の Web クライアントは、相対 URL を受け入れます。Dagonは RFC Matter を指摘しました。
14.30 場所
Location 応答ヘッダー フィールドは、要求の完了または新しいリソースの識別のために、受信者を Request-URI 以外の場所にリダイレクトするために使用されます。201 (Created) 応答の場合、Location はリクエストによって作成された新しいリソースの場所です。3xx 応答の場合、場所は、リソースへの自動リダイレクト用のサーバーの優先 URI を示す必要があります。フィールド値は、単一の絶対 URI で構成されます。
Location = "Location" ":" absoluteURI An example is:
Location: http://www.w3.org/pub/WWW/People.html
Note: The Content-Location header field (section 14.14) differs
from Location in that the Content-Location identifies the original
location of the entity enclosed in the request. It is therefore
possible for a response to contain header fields for both Location
and Content-Location. Also see section 13.10 for cache
requirements of some methods.