{"id":14102,"date":"2025-05-23T12:27:25","date_gmt":"2025-05-23T12:27:25","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=14102"},"modified":"2026-02-26T14:02:08","modified_gmt":"2026-02-26T14:02:08","slug":"how-to-create-a-301-redirect-in-htaccess","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/","title":{"rendered":"How to Create a 301 Redirect in .htaccess"},"content":{"rendered":"<p>This guide explains how to create a 301 redirect using the <a href=\"https:\/\/www.bodhost.com\/kb\/what-is-htaccess\/\" target=\"_blank\" rel=\"noopener\">.htaccess<\/a> file on your web server, including practical examples.<\/p>\n<p>A 301 redirect is a permanent redirect informing search engines and browsers that a page has moved to a new location. It\u2019s essential for SEO, preserving link equity, and improving user experience when URLs change.<\/p>\n<p><strong>To find the .htaccess file:<br \/>\n<\/strong>The .htaccess file is typically located in the root directory of your website (e.g., \/public_html\/). You can access and edit it through:<\/p>\n<ul>\n<li>cPanel File Manager<\/li>\n<li>FTP client (like FileZilla)<\/li>\n<li>SSH (if applicable)<\/li>\n<\/ul>\n<p><strong>Note:<\/strong> Always back up your .htaccess file before making changes.<\/p>\n<p><strong>To create a 301 Redirect:<br \/>\n<\/strong>Open the .htaccess file and add the redirect rules. Below are common examples.<\/p>\n<ol>\n<li><strong> Redirect a Single Page<br \/>\n<\/strong>Redirect from one page to another:<\/p>\n<pre>Redirect 301 \/old-page.html https:\/\/www.example.com\/new-page.html<\/pre>\n<\/li>\n<li>Redirect Entire Domain to a New Domain\n<pre>RewriteEngine On\r\nRewriteCond %{HTTP_HOST} ^oldsite\\.com [NC,OR]\r\nRewriteCond %{HTTP_HOST} ^www\\.oldsite\\.com [NC]\r\nRewriteRule ^(.*)$ https:\/\/www.newsite.com\/$1 [L,R=301,NC]<\/pre>\n<\/li>\n<li>Redirect Non-www to www\n<pre>RewriteEngine On\r\nRewriteCond %{HTTP_HOST} !^www\\. [NC]\r\nRewriteRule ^(.*)$ https:\/\/www.example.com\/$1 [L,R=301]<\/pre>\n<\/li>\n<li>Redirect HTTP to HTTPS\n<pre>RewriteEngine On\r\nRewriteCond %{HTTPS} off\r\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}\/$1 [L,R=301]<\/pre>\n<\/li>\n<\/ol>\n<p><strong>Tips for Using 301 Redirects<\/strong><\/p>\n<ul>\n<li>Use them sparingly and only when URLs have permanently changed.<\/li>\n<li>Incorrect redirects can lead to redirect loops or broken SEO.<\/li>\n<li>Test redirects after saving using browser or online tools (e.g., httpstatus.io).<\/li>\n<\/ul>\n<p>Setting up a 301 redirect through .htaccess is a simple but powerful way to manage URL changes and maintain SEO value. Be sure to test your redirects and keep a backup of your original file in case you need to revert.<\/p>\n<p>Find more information about: <em><a href=\"https:\/\/www.bodhost.com\/kb\/what-is-a-url-redirect-and-how-does-it-function\/\" target=\"_blank\" rel=\"noopener\">What is a URL Redirect and How does it Function<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples. A 301 redirect is a permanent redirect informing search engines&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837],"tags":[1620],"class_list":["post-14102","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-create-a-301-redirect-in-htaccess"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create a 301 Redirect in .htaccess | bodHOST<\/title>\n<meta name=\"description\" content=\"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.\" \/>\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.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/\" \/>\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 Redirect in .htaccess | bodHOST\" \/>\n<meta property=\"og:description\" content=\"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-23T12:27:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/05\/How-to-Create-a-301-Redirect-in-htaccess.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Serena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/05\/How-to-Create-a-301-Redirect-in-htaccess.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Serena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/\"},\"author\":{\"name\":\"Serena\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\"},\"headline\":\"How to Create a 301 Redirect in .htaccess\",\"datePublished\":\"2025-05-23T12:27:25+00:00\",\"dateModified\":\"2026-02-26T14:02:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/\"},\"wordCount\":243,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"Create a 301 Redirect in .htaccess\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/\",\"name\":\"How to Create a 301 Redirect in .htaccess | bodHOST\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2025-05-23T12:27:25+00:00\",\"dateModified\":\"2026-02-26T14:02:08+00:00\",\"description\":\"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-create-a-301-redirect-in-htaccess\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorial\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a 301 Redirect in .htaccess\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\",\"name\":\"Serena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"caption\":\"Serena\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/seema\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a 301 Redirect in .htaccess | bodHOST","description":"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.","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.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a 301 Redirect in .htaccess | bodHOST","og_description":"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2025-05-23T12:27:25+00:00","article_modified_time":"2026-02-26T14:02:08+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/05\/How-to-Create-a-301-Redirect-in-htaccess.png","type":"image\/png"}],"author":"Serena","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/05\/How-to-Create-a-301-Redirect-in-htaccess.png","twitter_misc":{"Written by":"Serena","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/"},"author":{"name":"Serena","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830"},"headline":"How to Create a 301 Redirect in .htaccess","datePublished":"2025-05-23T12:27:25+00:00","dateModified":"2026-02-26T14:02:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/"},"wordCount":243,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["Create a 301 Redirect in .htaccess"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/","name":"How to Create a 301 Redirect in .htaccess | bodHOST","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2025-05-23T12:27:25+00:00","dateModified":"2026-02-26T14:02:08+00:00","description":"This guide explains how to create a 301 redirect using the .htaccess file on your web server, including practical examples.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-create-a-301-redirect-in-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Tutorial","item":"https:\/\/www.bodhost.com\/kb\/category\/tutorial\/"},{"@type":"ListItem","position":2,"name":"How to Create a 301 Redirect in .htaccess"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830","name":"Serena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","caption":"Serena"},"url":"https:\/\/www.bodhost.com\/kb\/author\/seema\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=14102"}],"version-history":[{"count":2,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14102\/revisions"}],"predecessor-version":[{"id":14107,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14102\/revisions\/14107"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=14102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=14102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=14102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}