{"id":484,"date":"2026-04-15T13:24:19","date_gmt":"2026-04-15T17:24:19","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2012\/11\/27\/setting-up-a-301-permanent-redirect-via-htaccess\/"},"modified":"2026-04-15T13:34:07","modified_gmt":"2026-04-15T17:34:07","slug":"setting-up-a-301-permanent-redirect-via-htaccess","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/","title":{"rendered":"How to Set Up a 301 Permanent Redirect via .htaccess &amp; cPanel"},"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\/2020\/12\/301-Permanent-Redirects-1024x538.png\" alt=\"301 Permanent Redirects Title Image\" class=\"wp-image-65439\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p>A <strong>301 redirect<\/strong> tells browsers and search engines that a page or site has moved <strong>permanently<\/strong> to a new location. It passes nearly 100% of SEO value (link equity) to the new URL and prevents 404 errors for visitors.<\/p>\n\n\n\n<p>Use 301 redirects when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Changing URL structures or page names<\/li>\n\n\n\n<li>Migrating to a new domain<\/li>\n\n\n\n<li>Switching from HTTP to HTTPS<\/li>\n\n\n\n<li>Enforcing www vs. non-www (canonicalization)<\/li>\n\n\n\n<li>Retiring old content and pointing users to relevant pages<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">When Do You Need a 301 Redirect?<\/h2>\n\n\n\n<p>Common scenarios include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reorganizing site structure (e.g., \/old-page.html \u2192 \/new-page\/)<\/li>\n\n\n\n<li>Domain migration (olddomain.com \u2192 newdomain.com)<\/li>\n\n\n\n<li>Removing trailing slashes or fixing duplicate content issues<\/li>\n\n\n\n<li>Enforcing HTTPS for security and SEO<\/li>\n\n\n\n<li>Consolidating www and non-www versions of your site<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">.htaccess vs. cPanel Redirects: Which Should You Use?<\/h2>\n\n\n\n<p><strong>Editing .htaccess directly<\/strong> gives full control and works at the server level (faster). Ideal for complex rules.<\/p>\n\n\n\n<p><strong>cPanel Redirects<\/strong> (under Domains \u2192 Redirects) is beginner-friendly for simple cases but less flexible for patterns or multiple rules.<\/p>\n\n\n\n<p>For most users on InMotion Hosting, start with cPanel for basics. Use .htaccess when you need regex, multiple conditions, or advanced logic.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"jetpack-video-wrapper\"><div class=\"yt-NO7AkiwsMtA\">\n\t<a class=\"play-video-NO7AkiwsMtA\" style=\"position: relative; display: flex; flex-wrap: wrap; align-items: center; cursor: pointer;\">\n\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.ytimg.com\/vi_webp\/NO7AkiwsMtA\/maxresdefault.webp\" width=\"1280\" height=\"720\" alt=\"How to Redirect a Domain in cPanel\" style=\"width: 100%; height: auto;\">\n\t\t<span class=\"fa fa-imh-play-circle imh-ds-icon play-circle\" style=\"position: absolute; display:block; font-size:150px; color: #c52228; opacity:0;\"><\/span>\n\t<\/a>\n<\/div><\/div>\n<\/div><figcaption class=\"wp-element-caption\">Don\u2019t have time to read our article on how to set up a 301 redirect? Watch our walkthrough video.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"htaccess\">How to Edit Your .htaccess File in cPanel<\/h2>\n\n\n\n<p>On a Linux server you would <a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/where-is-my-htaccess-file\/\">use your <strong>.htaccess<\/strong> file<\/a> to implement a 301 redirect for your pages. We\u2019ll now show you how to edit the .htaccess file, then go over the different redirect options.<\/p>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li><a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/cpanel\/how-to-log-into-cpanel\/\">Log in to cPanel<\/a>.<\/li>\n\n\n\n<li>Under <em>Files<\/em>, click on <strong>File Manager<\/strong>.<br><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"140\" class=\"wp-image-82105\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/301-redirect-cpanel-file-manager.png\" alt=\"Access File Manager to Setup 301 Redirect in .htaccess\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/301-redirect-cpanel-file-manager.png 1068w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/301-redirect-cpanel-file-manager-300x56.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/301-redirect-cpanel-file-manager-1024x192.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/301-redirect-cpanel-file-manager-768x144.png 768w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>Ensure that <strong>Show Hidden Files<\/strong> is selected by clicking <strong>Settings<\/strong> on the top right corner of the File Manager.<br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"333\" class=\"wp-image-82106\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/show-hidden-files-to-setup-301-redirect.png\" alt=\"View Hidden Files to See .htaccess\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/show-hidden-files-to-setup-301-redirect.png 500w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/show-hidden-files-to-setup-301-redirect-300x200.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>Select the <strong>Document Root<\/strong> (usually <code>public_html<\/code>), or choose a domain from the drop-down.<\/li>\n\n\n\n<li>Right-click on the <strong>.htaccess<\/strong> file and select <strong>Edit<\/strong>.<br><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"322\" class=\"wp-image-82107\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-to-setup-301-redirect.png\" alt=\"Edit .htaccess File and Setup 301 Redirect\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-to-setup-301-redirect.png 627w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-to-setup-301-redirect-300x154.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>If your <strong>.htaccess<\/strong> file is still not found after the previous steps, click on <strong>New File<\/strong> at the top-left, name the file <strong>.htaccess<\/strong>, and set the directory for the file to be created to <strong>\/public_html\/<\/strong> or the document root of your site.<\/li>\n\n\n\n<li>You might have a text editor encoding dialog box pop-up, you can simply click on <strong>Edit<\/strong> to proceed.<br><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"346\" class=\"wp-image-82108\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-file-301-redirect.png\" alt=\"Edit .htaccess file - Setup 301 Redirect\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-file-301-redirect.png 502w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2012\/11\/edit-htaccess-file-301-redirect-300x207.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>Add your redirect rules at the <strong>top<\/strong> or <strong>bottom<\/strong> of the file (avoid middle if other rules exist).<\/li>\n\n\n\n<li>Click <strong>Save Changes<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p class=\"alert alert-info\"><strong>Important<\/strong>: Always back up your original .htaccess file before editing. A syntax error can make your site unavailable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"redirect-files\">How to Redirect a Single Page or File with 301<\/h3>\n\n\n\n<p>Use the simple <code>Redirect<\/code> directive (from mod_alias):<\/p>\n\n\n\n<p>To redirect individual files, like <strong>example.<span style=\"color: red;\">com<\/span>\/oldfile.html<\/strong> to <strong>newfile.html<\/strong> you can use a 301 redirect like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">Redirect<\/span><span style=\"color: #D4D4D4\"> 301 <\/span><span style=\"color: #CE9178\">\/oldfile.htm<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/newfile.html<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/single-file-301-redirect.gif\" alt=\"single file 301 redirect\"><\/figure>\n\n\n\n<p>To redirect one specific file to another domain such as <strong>example.<span style=\"color: red;\">com<\/span>\/oldfile.html<\/strong> to <strong>example.<span style=\"color: red;\">net<\/span>\/newfile.html<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">Redirect<\/span><span style=\"color: #D4D4D4\"> 301 <\/span><span style=\"color: #CE9178\">\/oldfile.html<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/newdomain.net\/newfile.html<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/single-file-domain-301-redirect.gif\" alt=\"single file domain 301 redirect\"><\/figure>\n\n\n\n<p>Both of these methods work well for exact paths or prefixes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"redirect-domain\">How to Redirect an Entire Old Domain to a New Domain<\/h3>\n\n\n\n<p>If you had an old domain such as <strong>example.com<\/strong> and you decided to use <strong>example.net<\/strong> for a website, you could setup a 301 redirect for the entire domain, so that old links to <strong>example.com<\/strong> carry over.<\/p>\n\n\n\n<p>Sample of code from <strong>example.com<\/strong> domain\u2019s <strong>.htaccess<\/strong> file:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">RewriteEngine<\/span><span style=\"color: #D4D4D4\"> on<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteCond<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">%{HTTP_HOST}<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">^(www\\.)?olddomain\\.com$<\/span><span style=\"color: #D4D4D4\"> [NC]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteRule<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">^(.*)$<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/newdomain.com\/$1<\/span><span style=\"color: #D4D4D4\"> [R=<\/span><span style=\"color: #B5CEA8\">301<\/span><span style=\"color: #D4D4D4\">,L]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/full-domain-301-redirect.gif\" alt=\"full domain 301 redirect\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"force-www\">How to Force www on Your Domain<\/h3>\n\n\n\n<p>A search engine such as Google interprets <strong>example.com<\/strong> and <strong>www.example.com<\/strong> as essentially two separate websites. It is recommended that users pick one version they\u2019d like search engines to display. By <a href=\"https:\/\/support.google.com\/webmasters\/answer\/139066?hl=en#301\" target=\"_blank\" rel=\"noreferrer noopener\">using a 301 redirect<\/a>, users can specify which domain name is displayed on their site.<\/p>\n\n\n\n<p>If you have a number of links on the web where people are linking to your site as <strong>example.com<\/strong>, but you would prefer your visitors end up at <strong>www.example.com<\/strong> instead, you can force this version of your domain with these rules:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">RewriteEngine<\/span><span style=\"color: #D4D4D4\"> On<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteCond<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">%{HTTP_HOST}<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">^example.com<\/span><span style=\"color: #D4D4D4\"> [NC]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteRule<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">^(.*)$<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/www.example.com\/$1<\/span><span style=\"color: #D4D4D4\"> [R=<\/span><span style=\"color: #B5CEA8\">301<\/span><span style=\"color: #D4D4D4\">,L]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/force-www-301-redirect.gif\" alt=\"force www 301 redirect\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"force-non-www\">How to Force Non-www on Your Domain<\/h3>\n\n\n\n<p>If you have a lot of links on the web where people are linking to your site as <strong>www.example.com<\/strong>, but you would prefer your visitors end up at <strong>example.com<\/strong> instead, you can force this version of your domain with these rules:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">RewriteEngine<\/span><span style=\"color: #D4D4D4\"> On<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteCond<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">%{HTTP_HOST}<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">^www\\.example.com<\/span><span style=\"color: #D4D4D4\"> [NC]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteRule<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">^(.*)$<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/example.com\/$1<\/span><span style=\"color: #D4D4D4\"> [R=<\/span><span style=\"color: #B5CEA8\">301<\/span><span style=\"color: #D4D4D4\">,L]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/force-non-www-301-redirect.gif\" alt=\"force non www 301 redirect\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">How to Enforce HTTPS (HTTP to HTTPS Redirect)<\/h3>\n\n\n\n<p>Add this near the top of your <strong>.htaccess<\/strong> (before other rewrite rules):<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">RewriteEngine<\/span><span style=\"color: #D4D4D4\"> On<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteCond<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">%{HTTPS}<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">off<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteRule<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">^(.*)$<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/%{HTTP_HOST}\/$1<\/span><span style=\"color: #D4D4D4\"> [R=<\/span><span style=\"color: #B5CEA8\">301<\/span><span style=\"color: #D4D4D4\">,L]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"redirect-by-extension\">How to Redirect Files by Extension (e.g., .php to .html)<\/h3>\n\n\n\n<p>To re-direct all of one type of file to another, such as <strong>example.com\/file.<span style=\"color: red;\">php<\/span><\/strong> to <strong>example.com\/file.<span style=\"color: red;\">html<\/span><\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">RewriteEngine<\/span><span style=\"color: #D4D4D4\"> On<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteCond<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">%{REQUEST_URI}<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\\.php$<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">RewriteRule<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D16969\">^(.*)\\.php$<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/$1.html<\/span><span style=\"color: #D4D4D4\"> [R=<\/span><span style=\"color: #B5CEA8\">301<\/span><span style=\"color: #D4D4D4\">,L]<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/support\/images\/stories\/htaccess\/301-redirect\/file-extension-301-redirect.gif\" alt=\"file extension 301 redirect\"><\/figure>\n\n\n\n<p>You should now know how to properly setup 301 permanent redirects on your website to help ensure that search engines and visitors coming to your site from older links can still get to your new content.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redirect vs. RewriteRule: When to Use Each<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Redirect 301<\/code><\/strong> (mod_alias): Simpler, great for basic redirects and prefix matching.<\/li>\n\n\n\n<li><strong><code>RewriteRule<\/code><\/strong> (mod_rewrite): More powerful for patterns, conditions (<code>RewriteCond<\/code>), and complex logic. Always include <code>[R=301,L]<\/code> for permanent redirects.<\/li>\n<\/ul>\n\n\n\n<p class=\"alert alert-info\"><strong>Best practice:<\/strong> If you use any <code>RewriteRule<\/code>, use <code>RewriteRule<\/code> for all your redirects to avoid module execution order issues.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Set Up 301 Redirect within cPanel<\/h2>\n\n\n\n<p>For users that host their sites on cPanel-based hosts, it is possible to set up redirects via the cPanel interface. This tool automatically adds the necessary code to the .htaccess file for the redirect to function properly.<\/p>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li><a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/cpanel\/how-to-log-into-cpanel\/\" target=\"_blank\" rel=\"noreferrer noopener\">Log in to cPanel<\/a>.<\/li>\n\n\n\n<li>Click the\u00a0<strong>Redirects<\/strong>\u00a0button in the\u00a0<strong>Domains<\/strong>\u00a0section.<br><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"346\" class=\"wp-image-14281\" style=\"width: 750px;\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects2.png\" alt=\"301 Redirect Button cPanel\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects2.png 1237w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects2-300x138.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects2-768x354.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects2-1024x472.png 1024w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>You will then be on the\u00a0<strong>Add Redirect<\/strong>\u00a0page. Click the drop-down box for\u00a0<strong>Type<\/strong>\u00a0and choose either a\u00a0<strong>Permanent (301)<\/strong>\u00a0or\u00a0<strong>Temporary (302)<\/strong>\u00a0redirect.<br><img loading=\"lazy\" decoding=\"async\" width=\"578\" height=\"686\" class=\"wp-image-14282\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirect-type2.png\" alt=\"301 Redirect Type cPanel\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirect-type2.png 578w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirect-type2-253x300.png 253w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>Click the next drop-down box and choose the domain you want to redirect.<br><img loading=\"lazy\" decoding=\"async\" width=\"563\" height=\"696\" class=\"wp-image-14283\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_choosing-domain2.png\" alt=\"301 Redirect Protocol cPanel\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_choosing-domain2.png 563w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_choosing-domain2-243x300.png 243w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>For the slash \u2018\/\u2019 field, enter any folder names (if necessary).<\/li>\n\n\n\n<li>Enter the address you want to redirect to in the\u00a0<strong>Redirects to<\/strong>\u00a0section.<br><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"699\" class=\"wp-image-14284\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects-to-address2.png\" alt=\"301 Redirect Target cPanel\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects-to-address2.png 749w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_redirects-to-address2-300x280.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n\n\n\n<li>Choose if you want to \u201c<strong>Only redirect with <code>www.<\/code><\/strong>\u201c, \u201c<strong>Redirect with or without <code>www.<\/code><\/strong>\u201c, or \u201c<strong>Do Not Redirect <code>www.<\/code><\/strong>\u201c<\/li>\n\n\n\n<li>Check the box if you want to create a\u00a0<strong>Wild Card Redirect<\/strong>. This will add the the file\/folder name after the url when it redirects. For instance, example.com\/test.php would redirect to example2.com\/test.php.<\/li>\n\n\n\n<li>Click\u00a0<strong>Add<\/strong>\u00a0when finished.<br><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"708\" class=\"wp-image-14285\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_add-redirect2.png\" alt=\"301 Redirect Save cPanel\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_add-redirect2.png 744w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2016\/09\/cpanel_redirect_add-redirect2-300x285.png 300w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Common Issues and How to Fix 301 Redirect Problems<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Redirect loops or \u201ctoo many redirects\u201d<\/strong>: Check rule order (specific rules first) and avoid chaining.<\/li>\n\n\n\n<li><strong>Rules not working<\/strong>: Clear browser cache, CDN cache, and server opcode cache. Test with incognito mode.<\/li>\n\n\n\n<li><strong>Mixed www\/non-www or HTTP\/HTTPS<\/strong>: Combine rules carefully or use a single canonical set.<\/li>\n\n\n\n<li><strong>Syntax errors<\/strong>: One missing character can break the site\u2014test incrementally.<\/li>\n\n\n\n<li><strong>cPanel redirects conflicting with .htaccess<\/strong>: Remove one method to avoid conflicts.<\/li>\n<\/ul>\n\n\n\n<p class=\"alert alert-info\"><strong>Testing tip:<\/strong> Temporarily use <code>R=302<\/code> (temporary) while testing, then change to <code>301<\/code> once verified. Use tools like redirect-checker.org or browser dev tools (Network tab) to confirm status codes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Additional Tips for Success<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Place specific redirects <strong>before<\/strong> general ones.<\/li>\n\n\n\n<li>Avoid redirect chains (old \u2192 intermediate \u2192 final) \u2014 go directly to the final URL.<\/li>\n\n\n\n<li>After changes, submit updated URLs in Google Search Console.<\/li>\n\n\n\n<li>For WordPress sites, consider a plugin like Redirection for easier management, but server-level <strong>.htaccess<\/strong> is faster.<\/li>\n<\/ul>\n\n\n\n<p>You should now be able to set up reliable 301 permanent redirects on your InMotion Hosting account. This helps preserve SEO value, improve user experience, and keep your site running smoothly during changes.<\/p>\n\n\n\n<p>If you run into issues, feel free to reach out to InMotion Support with your exact rules and the URLs you\u2019re trying to redirect.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A 301 redirect tells browsers and search engines that a page or site has moved permanently to a new location. It passes nearly 100% of SEO value (link equity) to the new URL and prevents 404 errors for visitors. Use 301 redirects when: When Do You Need a 301 Redirect? Common scenarios include: .htaccess vs.<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\"> Read More ><\/a><\/p>\n","protected":false},"author":56983,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288],"tags":[],"class_list":["post-484","post","type-post","status-publish","format-standard","hentry","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 Set Up a 301 Permanent Redirect via .htaccess (with Examples)<\/title>\n<meta name=\"description\" content=\"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.\" \/>\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\/setting-up-a-301-permanent-redirect-via-htaccess\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up a 301 Permanent Redirect via .htaccess (with Examples)\" \/>\n<meta property=\"og:description\" content=\"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\" \/>\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=\"2026-04-15T17:24:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-15T17:34:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.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\/setting-up-a-301-permanent-redirect-via-htaccess\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\"},\"author\":{\"name\":\"Carrie Smaha\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\"},\"headline\":\"How to Set Up a 301 Permanent Redirect via .htaccess &amp; cPanel\",\"datePublished\":\"2026-04-15T17:24:19+00:00\",\"dateModified\":\"2026-04-15T17:34:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\"},\"wordCount\":1199,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-1024x538.png\",\"articleSection\":[\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\",\"name\":\"How to Set Up a 301 Permanent Redirect via .htaccess (with Examples)\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-1024x538.png\",\"datePublished\":\"2026-04-15T17:24:19+00:00\",\"dateModified\":\"2026-04-15T17:34:07+00:00\",\"description\":\"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.png\",\"width\":1200,\"height\":630,\"caption\":\"Learn how to Create a 301 Redirect Using .htaccess\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up a 301 Permanent Redirect via .htaccess &amp; cPanel\"}]},{\"@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 Set Up a 301 Permanent Redirect via .htaccess (with Examples)","description":"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.","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\/setting-up-a-301-permanent-redirect-via-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up a 301 Permanent Redirect via .htaccess (with Examples)","og_description":"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2026-04-15T17:24:19+00:00","article_modified_time":"2026-04-15T17:34:07+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.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\/setting-up-a-301-permanent-redirect-via-htaccess\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/"},"author":{"name":"Carrie Smaha","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8"},"headline":"How to Set Up a 301 Permanent Redirect via .htaccess &amp; cPanel","datePublished":"2026-04-15T17:24:19+00:00","dateModified":"2026-04-15T17:34:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/"},"wordCount":1199,"commentCount":1,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-1024x538.png","articleSection":["Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/","name":"How to Set Up a 301 Permanent Redirect via .htaccess (with Examples)","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects-1024x538.png","datePublished":"2026-04-15T17:24:19+00:00","dateModified":"2026-04-15T17:34:07+00:00","description":"Step-by-step guide to setting up 301 permanent redirects using .htaccess on Apache servers. Includes code examples for pages, domains, HTTPS enforcement, and avoiding common redirect issues.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2020\/12\/301-Permanent-Redirects.png","width":1200,"height":630,"caption":"Learn how to Create a 301 Redirect Using .htaccess"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/setting-up-a-301-permanent-redirect-via-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Set Up a 301 Permanent Redirect via .htaccess &amp; cPanel"}]},{"@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\/484","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=484"}],"version-history":[{"count":39,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"predecessor-version":[{"id":131866,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/484\/revisions\/131866"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}