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
JSON Formatter
Format, validate, and beautify JSON. Minify or pretty-print with one click.
Base64 Decode
Decode Base64 strings to text. Encode text to Base64.
UUID Generator
Generate random UUIDs (v4) for unique identifiers. Copy with one click.
URL Encoder Decoder
Encode and decode URLs. Convert special characters for safe use in URLs.
Convert Color Hex to RGB
Convert hex color codes to RGB values (R, G, B).
Convert Color RGB to Hex
Convert RGB values (R, G, B) to hex color codes.