{"id":2310,"date":"2019-07-19T10:46:19","date_gmt":"2019-07-19T10:46:19","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=ht_kb&#038;p=2310"},"modified":"2020-03-25T14:42:29","modified_gmt":"2020-03-25T14:42:29","slug":"how-to-redirect-your-domain-to-a-subfolder-using-htaccess","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/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>In this tutorial, 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.<\/p>\n<p>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 directory\u201d or &#8220;document root&#8221;), you need to create a file called<strong> .htaccess.\u00a0<\/strong>You can do so by using the <a href=\"https:\/\/chemicloud.com\/kb\/article\/use-file-manager-cpanel\/\" target=\"_blank\" rel=\"noopener noreferrer\">File Manager<\/a> in cPanel.<\/p>\n<p>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:<\/p>\n<p><code>RewriteEngine On<br \/>\nRewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$<br \/>\nRewriteRule ^(\/)?$ blog [L]<\/code><\/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, 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&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[188],"ht-kb-tag":[203,202,197,201,200],"class_list":["post-2310","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-support-resources","ht_kb_tag-change-web-root","ht_kb_tag-changing-web-root","ht_kb_tag-document-root","ht_kb_tag-root-directory","ht_kb_tag-web-root"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=2310"}],"version-history":[{"count":1,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2310\/revisions"}],"predecessor-version":[{"id":2311,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/2310\/revisions\/2311"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=2310"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=2310"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=2310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}