{"id":435,"date":"2012-07-30T19:42:39","date_gmt":"2012-07-30T19:42:39","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2012\/07\/30\/force-www-htaccess\/"},"modified":"2026-07-28T11:33:30","modified_gmt":"2026-07-28T15:33:30","slug":"force-www-htaccess","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/","title":{"rendered":"How to Force www and non-www on Your Domain with .htaccess"},"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\/2021\/08\/force-www-hero-image-1024x538.png\" alt=\"force www hero image\" class=\"wp-image-82049\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Many customers at some point request to either <strong>force<\/strong> <strong>www<\/strong> or <strong>non-www<\/strong> version of their site to display in their visitor\u2019s browser. For example, you can have <em>www.example.com<\/em> or simply <em>example.com<\/em> display in an address bar. While this difference won\u2019t affect how visitors find your site, it can be a matter of aesthetic preference. This article will guide you through how to force www or non-www in your .htaccess file. You can access the .htaccess file through the cPanel File Manager.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Force www or non-www in your .htaccess file in cPanel<\/h2>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li>First, <a href=\"\/support\/edu\/cpanel\/how-to-log-into-cpanel\/\">log into your cPanel<\/a>.<\/li>\n\n\n\n<li>Once logged into cPanel, Find the <strong>Files <\/strong>category and click on the <strong>File Manager<\/strong> icon. <\/li>\n\n\n\n<li>Next, click <strong>Settings<\/strong> at the top right corner.<\/li>\n\n\n\n<li>In the Settings Menu, choose the document root (or folder) for the domain you are working with and be sure the checkbox next to <strong>Show Hidden Files<\/strong> is checked. Click the <strong>Save<\/strong> button. <div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>Look for the <em>.htaccess<\/em> file and right click on it. This brings up a menu. Find and click on the <strong>Edit <\/strong>option. <div style=\"clear: both;\"><\/div><\/li>\n\n\n\n<li>You are now in the text editor. Place either selection of code in the file and click on the <strong>Save Changes<\/strong> button at the top right corner of the screen. Be sure to replace \u2018<span style=\"text-decoration: underline;\"><em>example.com<\/em><\/span>\u2018 with your actual domain name. NOTE: do not place both selections of code in the file as it will cause an error. Below are examples of code that you can use to implement the desired change to the website.<br><div class=\"code_block\"><\/div><\/li>\n<\/ol>\n\n\n\n<h3 id=\"force-www\" class=\"wp-block-heading\">How to Force www on Your Domain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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 class=\"wp-block-paragraph\">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)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;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>RewriteEngine On\nRewriteCond %{HTTP_HOST} ^example.com [NC]\nRewriteRule ^(.*)$ https:\/\/www.example.com\/$1 [R=301,L]<\/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=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><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 id=\"force-non-www\" class=\"wp-block-heading\">How to Force Non-www on Your Domain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;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>RewriteEngine On\nRewriteCond %{HTTP_HOST} ^www\\.example.com [NC]\nRewriteRule ^(.*)$ https:\/\/example.com\/$1 [R=301,L]<\/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=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><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<p class=\"wp-block-paragraph\">Congratulations, you have successfully forced www or non-www! Now when you type in your domain name with either www in front or not, it should display as you have set it in the .htaccess file.<\/p>\n\n\n<div class=\"jumbotron\">Trust your business to an industry leader in fast and reliable website hosting solutions. InMotion Hosting offers secure <a href=\"https:\/\/www.inmotionhosting.com\/web-hosting\">web hosting<\/a> with 99.99% uptime, 24\/7 expert human support, and 100% money-back guarantee.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Many customers at some point request to either force www or non-www version of their site to display in their visitor&#8217;s browser. For example, you can have www.example.com or simply example.com display in an address bar. While this difference won&#8217;t affect how visitors find your site, it can be a matter of aesthetic preference. This<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-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_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_ayudawp_aiss_exclude":false,"_ayudawp_aiss_summary":"Many customers at some point request to either force www or non-www version of their site to display in their visitor's browser. This article will guide you through how to force www or non-www in your.htaccess file. Congratulations, you have successfully forced www or non-www!","_ayudawp_aiss_summary_provider":"extractive","_ayudawp_aiss_summary_hash":"5b88015e26f04c977770e94b814fa1fbc2884f5f","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4288],"tags":[],"class_list":["post-435","post","type-post","status-publish","format-standard","hentry","category-website"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Configure www or non-www Domain with .htaccess | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"This guide will teach you how to force your domain to use &quot;www&quot; or &quot;non-www&quot; with these simple .htaccess rules.\" \/>\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\/force-www-htaccess\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Configure www or non-www Domain with .htaccess | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"This guide will teach you how to force your domain to use &quot;www&quot; or &quot;non-www&quot; with these simple .htaccess rules.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-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=\"2012-07-30T19:42:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-28T15:33:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image.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=\"3 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\\\/force-www-htaccess\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/\"},\"author\":{\"name\":\"Carrie Smaha\",\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/#\\\/schema\\\/person\\\/595948dab2995d347a87076abdae19d8\"},\"headline\":\"How to Force www and non-www on Your Domain with .htaccess\",\"datePublished\":\"2012-07-30T19:42:39+00:00\",\"dateModified\":\"2026-07-28T15:33:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/\"},\"wordCount\":454,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/force-www-hero-image-1024x538.png\",\"articleSection\":[\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/\",\"url\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/\",\"name\":\"Configure www or non-www Domain with .htaccess | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/force-www-hero-image-1024x538.png\",\"datePublished\":\"2012-07-30T19:42:39+00:00\",\"dateModified\":\"2026-07-28T15:33:30+00:00\",\"description\":\"This guide will teach you how to force your domain to use \\\"www\\\" or \\\"non-www\\\" with these simple .htaccess rules.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/force-www-hero-image.png\",\"contentUrl\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/force-www-hero-image.png\",\"width\":1200,\"height\":630,\"caption\":\"force www hero image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/website\\\/force-www-htaccess\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.inmotionhosting.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Force www and non-www on Your Domain with .htaccess\"}]},{\"@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 digital strategy, web development, and SEO leader with 20 years of experience. She built her foundation in fast-paced agency environments before moving in-house to InMotion Hosting, where she leads go-to-market programs, agency initiatives, and technical product marketing that connects product capability to real customer decisions.\",\"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":"Configure www or non-www Domain with .htaccess | InMotion Hosting","description":"This guide will teach you how to force your domain to use \"www\" or \"non-www\" with these simple .htaccess rules.","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\/force-www-htaccess\/","og_locale":"en_US","og_type":"article","og_title":"Configure www or non-www Domain with .htaccess | InMotion Hosting","og_description":"This guide will teach you how to force your domain to use \"www\" or \"non-www\" with these simple .htaccess rules.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2012-07-30T19:42:39+00:00","article_modified_time":"2026-07-28T15:33:30+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image.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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/"},"author":{"name":"Carrie Smaha","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8"},"headline":"How to Force www and non-www on Your Domain with .htaccess","datePublished":"2012-07-30T19:42:39+00:00","dateModified":"2026-07-28T15:33:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/"},"wordCount":454,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image-1024x538.png","articleSection":["Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/","name":"Configure www or non-www Domain with .htaccess | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image-1024x538.png","datePublished":"2012-07-30T19:42:39+00:00","dateModified":"2026-07-28T15:33:30+00:00","description":"This guide will teach you how to force your domain to use \"www\" or \"non-www\" with these simple .htaccess rules.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2021\/08\/force-www-hero-image.png","width":1200,"height":630,"caption":"force www hero image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/force-www-htaccess\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Force www and non-www on Your Domain with .htaccess"}]},{"@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 digital strategy, web development, and SEO leader with 20 years of experience. She built her foundation in fast-paced agency environments before moving in-house to InMotion Hosting, where she leads go-to-market programs, agency initiatives, and technical product marketing that connects product capability to real customer decisions.","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\/435","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=435"}],"version-history":[{"count":10,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":900124,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/435\/revisions\/900124"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}