QuickFreeTools

Online PHP Redirect

Generate PHP redirect code. Enter a URL and get header('Location: ...') or 301/302 snippet for server-side redirect.

<?php
header("Location: https://example.com", true, 301);
exit;
?>

Frequently Asked Questions

What status code is used?
You can choose 301 (permanent) or 302 (temporary). 301 is better for SEO when a page has permanently moved.
Must redirect be before any output?
Yes. header() must be called before any HTML or whitespace output; otherwise you may get 'headers already sent' errors.
Should I use exit after redirect?
Yes. It's good practice to call exit or die after header('Location: ...') so the script stops and the redirect is sent.

Related Developer Tools