redirect domain to subdirectory without redirect url

How to redirect domain to sub-directory without redirect to  URL ?
Ans:
If you want to redirect your domain name to sub-directory but the url shows only domain name
For example :

http://indianwebportal.com redirect to http://indianwebportal.com/blog but the URL shows only http://indianwebportal.com
Then add the following rules in your .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^indianwebportal\.com
RewriteRule ^(.*)$ http://www.indianwebportal.com/$1 [R=301,L]
RewriteRule    ^$   blog/    [L]
RewriteRule    (.*)  blog/$1 [L]
</IfModule>

Note: Replace the “indianwebportal.com” to your original domain name and “blog” to your original directory name.
Done

Related posts

One Thought to “redirect domain to subdirectory without redirect url”

  1. zerodtkjoe

    Thanks for the info

Comments are closed.