{"id":130934,"date":"2025-12-09T16:08:52","date_gmt":"2025-12-09T21:08:52","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=130934"},"modified":"2025-12-09T16:11:13","modified_gmt":"2025-12-09T21:11:13","slug":"how-to-create-a-php-redirect","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/","title":{"rendered":"How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples)"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png\" alt=\"How To Create a PHP Redirect Hero Image\" class=\"wp-image-130935\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n<div class=\"wp-block-post-excerpt\"><p class=\"wp-block-post-excerpt__excerpt\">PHP redirects let you send users from one page to another using server-side code. In this tutorial, you\u2019ll learn how to create 301 and 302 redirects in PHP, redirect after forms, enforce HTTPS, and handle conditional or dynamic redirects. It also covers common errors, testing methods, and best practices to keep your site fast, secure, and SEO-friendly. <\/p><\/div>\n\n\n<p>Redirects are one of the most important tools for keeping your website organized, secure, and SEO-friendly. If you ever move or rename pages, update your domain, or need to guide visitors to a new location, a redirect makes sure they get there automatically.<\/p>\n\n\n\n<p>While many users set up redirects in .htaccess or cPanel, you can also use PHP redirects directly in your code. This guide explains how PHP redirects work, when to use them, and provides step-by-step examples for both permanent (301) and temporary (302) redirects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is a PHP Redirect?<\/h2>\n\n\n\n<p>If you\u2019ve ever clicked on a link that quickly took you somewhere else, you\u2019ve experienced a redirect in action. A PHP redirect uses server-side code to tell browsers to load a different web address instead of the one requested. It\u2019s simple, powerful, and an essential tool when your website structure changes.<\/p>\n\n\n\n<p>A PHP redirect sends a user\u2019s browser (and search engines) from one web address to another using the header() function. It works server-side, before the page content loads.<\/p>\n\n\n\n<p>Unlike HTML meta refresh or JavaScript redirects, PHP redirects happen before any HTML output. This makes them faster and more reliable for SEO and user experience.<\/p>\n\n\n\n<p>When used properly, PHP redirects ensure visitors and search engines always reach the correct destination. They\u2019re especially valuable for dynamic or logic-based website setups.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.inmotionhosting.com\/blog\/wp-content\/uploads\/2025\/10\/Screenshot-2025-10-09-at-1.31.35-PM.png\" alt=\"301 Redirect Example\" class=\"wp-image-81241\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">When To Use a PHP Redirect<\/h2>\n\n\n\n<p>Before adding redirects, it\u2019s important to understand when PHP is the right choice. PHP redirects are great when you need conditional or logic-based control rather than simple static rules. They\u2019re especially useful for dynamic websites or marketing teams that update landing pages frequently.<\/p>\n\n\n\n<p>You might use PHP redirects when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You\u2019ve changed the location of a page or file.<\/li>\n\n\n\n<li>You\u2019ve migrated content from one domain to another.<\/li>\n\n\n\n<li>You want to redirect users after logging in or submitting a form.<\/li>\n\n\n\n<li>You need conditional logic. This could include redirecting users based on region, session, or device.<\/li>\n<\/ul>\n\n\n\n<p>For most static redirects, <code>.htaccess<\/code> is faster. But PHP redirects are ideal when you need flexibility or logic-based control that can\u2019t be handled with simple rewrite rules.<\/p>\n\n\n\n<p>If your redirect requires decision-making or depends on user actions, PHP is the most flexible solution. It\u2019s a good option when your redirect logic can\u2019t be defined in simple patterns.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How PHP Redirects Work<\/h2>\n\n\n\n<p>Understanding how PHP redirects work helps prevent errors before they happen. Every redirect is built around a single PHP function that tells the browser to go somewhere else. This happens before the browser renders any content, so it must occur early in your code.<\/p>\n\n\n\n<p>The <code>header()<\/code> function in PHP sends an HTTP response header before any content is sent to the browser. To redirect, it uses a <strong>Location header<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nheader(\"Location: https:\/\/example.com\/new-page.php\");\nexit();\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: https:\/\/example.com\/new-page.php\"<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Two key details:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Always call <code>exit()<\/code> right after the header to stop script execution.<\/li>\n\n\n\n<li>The <code>header()<\/code> call must come <strong>before any HTML output<\/strong>, including whitespace.<\/li>\n<\/ol>\n\n\n\n<p>If you accidentally place it after page content, you\u2019ll get an error like:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>Warning: Cannot modify header information - headers already sent<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">Warning<\/span><span style=\"color: #E1E4E8\">: <\/span><span style=\"color: #79B8FF\">Cannot<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">modify<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">information<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">headers<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">already<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">sent<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In short, PHP redirects must run before the browser receives any output. Following these simple rules ensures clean, fast redirects without unexpected <code>behavior.y<\/code> output. Following these simple rules ensures clean, fast redirects without unexpected behavior.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Types of PHP Redirects<\/h2>\n\n\n\n<p>Different redirects serve different purposes, and knowing which to use prevents SEO and usability issues. PHP supports both permanent and temporary redirects through HTTP status codes. Choosing the right one helps you control how search engines and browsers interpret your changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. 301 Permanent Redirect<\/h3>\n\n\n\n<p>A <strong>301 redirect<\/strong> tells browsers and search engines that the page has moved permanently. It\u2019s the best option when you want to preserve SEO rankings and transfer link equity.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nheader(\"Location: https:\/\/example.com\/new-page.php\", true, 301);\nexit();\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: https:\/\/example.com\/new-page.php\"<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">true<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">301<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Use this when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You\u2019ve changed your domain or site structure.<\/li>\n\n\n\n<li>You want search engines to update to the new URL.<\/li>\n\n\n\n<li>You\u2019ve deleted a page but have a new one that replaces it.<\/li>\n<\/ul>\n\n\n\n<p>A 301 redirect keeps your SEO value intact and ensures users always reach the correct page. It\u2019s the best long-term redirect for stable, permanent changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. 302 Temporary Redirect<\/h3>\n\n\n\n<p>A <strong>302 redirect<\/strong> signals that the move is temporary. Use it when a page is under maintenance or during A\/B testing.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nheader(\"Location: https:\/\/example.com\/temporary-page.php\", true, 302);\nexit();\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: https:\/\/example.com\/temporary-page.php\"<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">true<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">302<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Search engines won\u2019t replace the old URL in their index with a 302, which makes it safer for short-term changes.<\/p>\n\n\n\n<p>When your page returns to its original address, a 302 redirect ensures no SEO data is lost. It\u2019s the ideal choice for brief or experimental updates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Redirect Without Changing the URL<\/h2>\n\n\n\n<p>Sometimes you need to display content from another domain while keeping your own URL in the address bar. This setup is common when combining content from different sources or showing third-party pages under your brand\u2019s domain. However, it should be used with caution due to SEO implications.<\/p>\n\n\n\n<p>Here\u2019s a simple example using PHP\u2019s <code>readfile()<\/code> function:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n$url = 'https:\/\/example.com\/new-page.php';\necho file_get_contents($url);\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">$url <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'https:\/\/example.com\/new-page.php'<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">echo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">file_get_contents<\/span><span style=\"color: #E1E4E8\">($url);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This method displays the remote content without redirecting the browser. However, it\u2019s not recommended for large or dynamic sites, it increases server load and can create SEO duplication issues. <\/p>\n\n\n\n<p>For SEO-safe domain proxies, use <code>.htaccess<\/code> rules with the [P] flag, as described in Redirect a Domain Without Changing the URL.<\/p>\n\n\n\n<p>When possible, use proper 301 redirects instead of masking URLs. This maintains SEO integrity and ensures consistent visitor tracking.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect After a Form Submission<\/h2>\n\n\n\n<p>Redirecting after a form submission helps guide users to confirmation pages or new actions. It also prevents duplicate submissions if someone refreshes the page. This method is widely used in contact forms, signup pages, and checkout flows.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nif ($_SERVER[\"REQUEST_METHOD\"] == \"POST\") {\n    \/\/ process form data here\n    header(\"Location: thank-you.php\");\n    exit();\n}\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> ($_SERVER[<\/span><span style=\"color: #9ECBFF\">\"REQUEST_METHOD\"<\/span><span style=\"color: #E1E4E8\">] <\/span><span style=\"color: #F97583\">==<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\"POST\"<\/span><span style=\"color: #E1E4E8\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #6A737D\">\/\/ process form data here<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: thank-you.php\"<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This prevents duplicate submissions when users refresh the page and creates a smooth post-submission experience.<\/p>\n\n\n\n<p>Adding redirects after form processing improves usability and makes your site feel more professional. It\u2019s also a simple way to track conversions or completed actions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect Based on User Type or Session<\/h2>\n\n\n\n<p>Conditional redirects let you send visitors to different locations depending on who they are or what they\u2019re doing. This is useful for login systems, membership sites, or marketing campaigns with personalized landing pages. You can easily achieve this using PHP\u2019s session management.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nsession_start();\n\nif (!isset($_SESSION['user_id'])) {\n    header(\"Location: \/login.php\");\n    exit();\n} else {\n    header(\"Location: \/dashboard.php\");\n    exit();\n}\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">session_start<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> (<\/span><span style=\"color: #F97583\">!<\/span><span style=\"color: #79B8FF\">isset<\/span><span style=\"color: #E1E4E8\">($_SESSION[<\/span><span style=\"color: #9ECBFF\">'user_id'<\/span><span style=\"color: #E1E4E8\">])) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: \/login.php\"<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">} <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: \/dashboard.php\"<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This code checks if a user is logged in. If not, they\u2019re redirected to the login page; otherwise, they\u2019re sent to their dashboard.<\/p>\n\n\n\n<p>Using conditional logic gives your redirects purpose and personalization. It also makes managing secure and role-based content more efficient.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect to HTTPS Automatically<\/h2>\n\n\n\n<p>Redirecting users to HTTPS helps keep data secure and builds visitor trust. If your <code>.htaccess<\/code> rules aren\u2019t applying properly, you can do it directly with PHP. This ensures all users access the secure version of your site.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nif ($_SERVER[\"HTTPS\"] != \"on\") {\n    $redirect = \"https:\/\/\" . $_SERVER[\"HTTP_HOST\"] . $_SERVER[\"REQUEST_URI\"];\n    header(\"Location: $redirect\", true, 301);\n    exit();\n}\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">if<\/span><span style=\"color: #E1E4E8\"> ($_SERVER[<\/span><span style=\"color: #9ECBFF\">\"HTTPS\"<\/span><span style=\"color: #E1E4E8\">] <\/span><span style=\"color: #F97583\">!=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\"on\"<\/span><span style=\"color: #E1E4E8\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    $redirect <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\"https:\/\/\"<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\"> $_SERVER[<\/span><span style=\"color: #9ECBFF\">\"HTTP_HOST\"<\/span><span style=\"color: #E1E4E8\">] <\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\"> $_SERVER[<\/span><span style=\"color: #9ECBFF\">\"REQUEST_URI\"<\/span><span style=\"color: #E1E4E8\">];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: <\/span><span style=\"color: #E1E4E8\">$redirect<\/span><span style=\"color: #9ECBFF\">\"<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">true<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">301<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>However, for permanent SSL enforcement, the <code>.htaccess<\/code> or cPanel redirect method described in <a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/forcing-your-websites-visitors-to-use-ssl\/\">Forcing Visitors to Use Shared SSL<\/a> is more efficient.<\/p>\n\n\n\n<p>This approach adds an extra layer of protection for websites without access to server-level redirects. It\u2019s an easy fallback for ensuring HTTPS compliance across your site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect Entire Folders or File Types in PHP<\/h2>\n\n\n\n<p>Sometimes you need to redirect a group of pages at once, such as when you change file extensions or folder names. Instead of listing each URL manually, you can automate it using PHP. This approach works well during rebrands or site restructures.<\/p>\n\n\n\n<p><strong>Redirect all <code>.php<\/code> files to <code>.html<\/code> equivalents:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n$old_ext = \".php\";\n$new_ext = \".html\";\n$redirect = str_replace($old_ext, $new_ext, $_SERVER[\"REQUEST_URI\"]);\nheader(\"Location: $redirect\", true, 301);\nexit();\n?&gt;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;?<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">$old_ext <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\".php\"<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">$new_ext <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\".html\"<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">$redirect <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">str_replace<\/span><span style=\"color: #E1E4E8\">($old_ext, $new_ext, $_SERVER[<\/span><span style=\"color: #9ECBFF\">\"REQUEST_URI\"<\/span><span style=\"color: #E1E4E8\">]);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">\"Location: <\/span><span style=\"color: #E1E4E8\">$redirect<\/span><span style=\"color: #9ECBFF\">\"<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">true<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">301<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">exit<\/span><span style=\"color: #E1E4E8\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This works like a dynamic mapping rule; it reads the original request and sends visitors to the updated file path.<\/p>\n\n\n\n<p>Bulk redirects save time and reduce the risk of broken links. They\u2019re a smart way to handle large-scale content changes efficiently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Testing Your Redirects<\/h2>\n\n\n\n<p>Testing verifies that your redirects send users to the right location with the correct status code. A simple check before publishing can prevent broken links and SEO issues. You can test using browser tools or command-line utilities.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using Browser Developer Tools<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the Network tab in Chrome or Firefox.<\/li>\n\n\n\n<li>Refresh the page you redirected.<\/li>\n\n\n\n<li>Look for the 301 or 302 response code.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Using cURL (Command Line)<\/h3>\n\n\n\n<p>Run this command:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -I https:\/\/example.com\/old-page.php<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">curl<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-I<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">https:\/\/example.com\/old-page.php<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>You should see output like:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>HTTP\/1.1 301 Moved Permanently\nLocation: https:\/\/example.com\/new-page.php<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">HTTP\/1.1<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">301<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">Moved<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">Permanently<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">Location:<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">https:\/\/example.com\/new-page.php<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If the status code doesn\u2019t appear or shows <code>200 OK<\/code>, check your syntax or confirm that the redirect code runs before any output.<\/p>\n\n\n\n<p>Always verify redirects before deployment. Doing so prevents loops, errors, and indexing issues later on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting Common Redirect Issues<\/h2>\n\n\n\n<p>Redirect errors usually come from syntax mistakes or code placement. Fortunately, most are easy to identify and fix. Use this quick reference table when something doesn\u2019t work as expected.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Problem<\/th><th class=\"has-text-align-left\" data-align=\"left\">Cause<\/th><th class=\"has-text-align-left\" data-align=\"left\">Solution<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">\u201cHeaders already sent\u201d error<\/td><td class=\"has-text-align-left\" data-align=\"left\">Move the redirect code to the top of the file<\/td><td class=\"has-text-align-left\" data-align=\"left\">Move the PHP block above the page output<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Infinite redirect loop<\/td><td class=\"has-text-align-left\" data-align=\"left\">Redirect URL points back to itself<\/td><td class=\"has-text-align-left\" data-align=\"left\">Double-check the redirect destination<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Wrong redirect type<\/td><td class=\"has-text-align-left\" data-align=\"left\">Forgot the status code parameter<\/td><td class=\"has-text-align-left\" data-align=\"left\">Add true, 301 or true, 302<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Redirect doesn\u2019t trigger<\/td><td class=\"has-text-align-left\" data-align=\"left\">PHP code placed after HTML<\/td><td class=\"has-text-align-left\" data-align=\"left\">Move the PHP block above the page output<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Browser caching old redirect<\/td><td class=\"has-text-align-left\" data-align=\"left\">The browser stored the previous redirect<\/td><td class=\"has-text-align-left\" data-align=\"left\">Clear cache or test in incognito mode<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>These are some of the most frequent redirect problems developers encounter. With careful testing and placement, PHP redirects can run reliably and error-free.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Redirect vs. .htaccess Redirect<\/h2>\n\n\n\n<p>When deciding how to manage redirects, it helps to know how PHP compares to .htaccess. Both can handle the same outcome but operate at different stages of the request process. This table shows when each method makes the most sense.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Feature<\/th><th class=\"has-text-align-left\" data-align=\"left\">PHP Redirect<\/th><th class=\"has-text-align-left\" data-align=\"left\">.htaccess Redirect<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">Runs at<\/td><td class=\"has-text-align-left\" data-align=\"left\">Application level<\/td><td class=\"has-text-align-left\" data-align=\"left\">Server level<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Speed<\/td><td class=\"has-text-align-left\" data-align=\"left\">Slightly slower<\/td><td class=\"has-text-align-left\" data-align=\"left\">Faster<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Control<\/td><td class=\"has-text-align-left\" data-align=\"left\">Conditional and dynamic<\/td><td class=\"has-text-align-left\" data-align=\"left\">Static and global<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Syntax<\/td><td class=\"has-text-align-left\" data-align=\"left\">PHP code<\/td><td class=\"has-text-align-left\" data-align=\"left\">Apache rewrite rules<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">Best for<\/td><td class=\"has-text-align-left\" data-align=\"left\">Logic-based redirects<\/td><td class=\"has-text-align-left\" data-align=\"left\">Simple page\/domain moves<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>If you only need to move pages or enforce HTTPS, .htaccess rules like those in How to Set Up a 301 Redirect in .htaccess are the preferred option. PHP is best when you need decision-based logic.<\/p>\n\n\n\n<p>Understanding when to use each method helps keep your redirects organized and efficient. Mixing both approaches can provide the best balance of speed and flexibility.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Redirect Best Practices<\/h2>\n\n\n\n<p>Following best practices ensures your redirects stay fast, predictable, and easy to maintain. These habits also help prevent SEO loss during major website changes. Keep these principles in mind when implementing your redirects.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Always use <code>exit()<\/code> after redirect headers.<\/li>\n\n\n\n<li>Avoid mixing redirects and output in the same file.<\/li>\n\n\n\n<li>Use absolute URLs for clarity.<\/li>\n\n\n\n<li>Keep redirect logic in a separate configuration or include file.<\/li>\n\n\n\n<li>Test frequently and document every redirect.<\/li>\n<\/ol>\n\n\n\n<p>For SEO safety, use 301 redirects whenever a page or URL permanently changes. Reserve 302s for short-term use.<\/p>\n\n\n\n<p>Good redirect habits prevent headaches down the road and make future maintenance easier. Proper testing and documentation are the best insurance for site stability.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Redirects are a small but powerful part of website management. PHP provides a flexible way to control how users and search engines navigate between URLs. Whether you\u2019re migrating pages, testing campaigns, or enforcing HTTPS, knowing how to use PHP redirects helps your site stay reliable and search-friendly.<\/p>\n\n\n\n<p>A PHP redirect lets you move users from one page or domain to another dynamically, using server-side code. For permanent changes, use 301 redirects; for temporary or testing purposes, use 302s. Test each redirect carefully, and if you need to handle bulk or complex cases, combine PHP redirects with <code>.htaccess<\/code> or cPanel tools.<\/p>\n\n\n\n<p>Using PHP redirects properly ensures a smooth, professional experience for your visitors. It also protects your SEO value and gives you fine-tuned control over your website\u2019s flow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><em>PHP redirects let you send users from one page to another using server-side code. In this tutorial, you\u2019ll learn how to create 301 and 302 redirects in PHP, redirect after forms, enforce HTTPS, and handle conditional or dynamic redirects. It also covers common errors, testing methods, and best practices to keep your site fast, secure, and SEO-friendly.<\/em><\/p>\n","protected":false},"author":56983,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4615,4288],"tags":[],"class_list":["post-130934","post","type-post","status-publish","format-standard","hentry","category-php","category-website"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Create a 301 and 302 PHP Redirect | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Create a 301 and 302 PHP Redirect | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-09T21:08:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-09T21:11:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Carrie Smaha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@carriesmaha\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carrie Smaha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\"},\"author\":{\"name\":\"Carrie Smaha\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\"},\"headline\":\"How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples)\",\"datePublished\":\"2025-12-09T21:08:52+00:00\",\"dateModified\":\"2025-12-09T21:11:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\"},\"wordCount\":1872,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png\",\"articleSection\":[\"PHP\",\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\",\"name\":\"How To Create a 301 and 302 PHP Redirect | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png\",\"datePublished\":\"2025-12-09T21:08:52+00:00\",\"dateModified\":\"2025-12-09T21:11:13+00:00\",\"description\":\"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png\",\"width\":1200,\"height\":630,\"caption\":\"How to Create PHP Redirects\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\",\"name\":\"Carrie Smaha\",\"description\":\"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/carriesmaha\/\",\"https:\/\/x.com\/carriesmaha\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Create a 301 and 302 PHP Redirect | InMotion Hosting","description":"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/","og_locale":"en_US","og_type":"article","og_title":"How To Create a 301 and 302 PHP Redirect | InMotion Hosting","og_description":"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2025-12-09T21:08:52+00:00","article_modified_time":"2025-12-09T21:11:13+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png","type":"image\/png"}],"author":"Carrie Smaha","twitter_card":"summary_large_image","twitter_creator":"@carriesmaha","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Carrie Smaha","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/"},"author":{"name":"Carrie Smaha","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8"},"headline":"How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples)","datePublished":"2025-12-09T21:08:52+00:00","dateModified":"2025-12-09T21:11:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/"},"wordCount":1872,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png","articleSection":["PHP","Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/","name":"How To Create a 301 and 302 PHP Redirect | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42-1024x538.png","datePublished":"2025-12-09T21:08:52+00:00","dateModified":"2025-12-09T21:11:13+00:00","description":"Learn how to create PHP 301 and 302 redirects with code examples, testing tips, and best practices for SEO and site performance.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2025\/10\/Technology-How-To-Solid-3-Jacksons-Purple-42.png","width":1200,"height":630,"caption":"How to Create PHP Redirects"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-create-a-php-redirect\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples)"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8","name":"Carrie Smaha","description":"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.","sameAs":["https:\/\/www.linkedin.com\/in\/carriesmaha\/","https:\/\/x.com\/carriesmaha"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4288,"name":"Website","slug":"website","link":"https:\/\/www.inmotionhosting.com\/support\/website\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/130934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/56983"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=130934"}],"version-history":[{"count":3,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/130934\/revisions"}],"predecessor-version":[{"id":131289,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/130934\/revisions\/131289"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=130934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=130934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=130934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}