{"id":1018,"date":"2015-06-28T21:01:58","date_gmt":"2015-06-29T02:01:58","guid":{"rendered":"https:\/\/hostease.com\/blog\/?p=1018"},"modified":"2024-11-27T02:34:54","modified_gmt":"2024-11-27T07:34:54","slug":"how-to-redirect-your-domain-to-a-subfolder-using-htaccess","status":"publish","type":"post","link":"https:\/\/www.hostease.com\/blog\/website\/how-to-redirect-your-domain-to-a-subfolder-using-htaccess\/","title":{"rendered":"How To Redirect Your Domain To A Subfolder Using .htaccess"},"content":{"rendered":"<p>Sometimes the simple things are the hardest to figure out and today we are going to show you a simple way to redirect your primary domain to a subfolder on that domain. For the purposes of this tutorial it will redirect to a subfolder at \/blog. This is useful if your WordPress blog is installed to a subfolder and you want the main domain to forward to it.<\/p>\n<p>In your public_html folder (also called the \u201croot html\u201d folder), you need to create a file called .htaccess. From this file we are going to use a few lines to redirect those requests in a search engine friendly way.<\/p>\n<p>Add the following lines to that file:<br \/>\nRewriteEngine On<br \/>\nRewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$<br \/>\nRewriteRule ^(\/)?$ blog [L]<\/p>\n<p>The only change you need to make is to change \u201cYourDomain.com\u201d to your domain. This will then redirect everything from the domain to the folder \/blog at that domain. If you want to change that folder just edit the \u201cblog\u201d part.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to easily redirect your primary domain to a subfolder using the .htaccess file. This method is useful for scenarios like when your WordPress blog is installed in a subfolder (e.g., \/blog) and you want your main domain to forward traffic to that location. Follow the simple steps to configure the redirect in a search-engine-friendly way and ensure a smooth user experience.<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[87,512,434],"class_list":["post-1018","post","type-post","status-publish","format-standard","hentry","category-website","tag-htaccess","tag-redirection","tag-web-hosting-for-businesses"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/1018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/comments?post=1018"}],"version-history":[{"count":1,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/1018\/revisions"}],"predecessor-version":[{"id":2138,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/1018\/revisions\/2138"}],"wp:attachment":[{"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/media?parent=1018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/categories?post=1018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostease.com\/blog\/wp-json\/wp\/v2\/tags?post=1018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}