{"id":1711,"date":"2021-09-07T12:05:06","date_gmt":"2021-09-07T12:05:06","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=1711"},"modified":"2021-09-08T08:59:54","modified_gmt":"2021-09-08T08:59:54","slug":"how-to-redirect-domain-to-subdirectory-without-redirecting-url","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/how-to-redirect-domain-to-subdirectory-without-redirecting-url\/","title":{"rendered":"How to redirect domain to subdirectory without redirecting url"},"content":{"rendered":"<p>If the url shows only domain name and if you want to redirect your domain name to sub-directory<\/p>\n<p>For example :<\/p>\n<p>http:\/\/yourdomain.com redirect to http:\/\/yourdomain.com\/blog but the URL shows only http:\/\/yourdomain.com<\/p>\n<p>Then add the following rules in your .htaccess file.<\/p>\n<p><strong>&lt;IfModule mod_rewrite.c&gt;<\/strong><br \/>\n<strong>RewriteEngine on<\/strong><br \/>\n<strong>RewriteCond %{HTTP_HOST} ^yourdomain.com<\/strong><br \/>\n<strong>RewriteRule ^(.*)$ http:\/\/www.yourdomain.com\/$1 [R=301,L]<\/strong><br \/>\n<strong>RewriteRule\u00a0\u00a0\u00a0 ^$\u00a0\u00a0 blog\/\u00a0\u00a0\u00a0 [L]<\/strong><br \/>\n<strong>RewriteRule\u00a0\u00a0\u00a0 (.*)\u00a0 blog\/$1 [L]<\/strong><br \/>\n<strong>&lt;\/IfModule&gt;<\/strong><\/p>\n<p>It is easy but to perform this task you need to consider one of the\u00a0<a href=\"https:\/\/ownwebservers.com\/\" target=\"_blank\" rel=\"noopener\">Ownwebservers web hosting plans<\/a>\u00a0and then edit or upload a .htaccess file from your file manager or SSH access on your cPanel hosting plan or a Linux Dedicated Server or the linux VPS hosting plan.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If the url shows only domain name and if you want to redirect your domain name to sub-directory For example : http:\/\/yourdomain.com redirect to http:\/\/yourdomain.com\/blog but the URL shows only http:\/\/yourdomain.com Then add the following rules in your .htaccess file. &lt;IfModule mod_rewrite.c&gt; RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain.com RewriteRule ^(.*)$ http:\/\/www.yourdomain.com\/$1 [R=301,L] RewriteRule\u00a0\u00a0\u00a0 ^$\u00a0\u00a0 blog\/\u00a0\u00a0\u00a0 [L] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-1711","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=1711"}],"version-history":[{"count":2,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1750,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1711\/revisions\/1750"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}