Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: how-to-redirect-domain-to-subdirectory-without-redirecting-url  (Read 2434 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
how-to-redirect-domain-to-subdirectory-without-redirecting-url
« on: February 23, 2014, 08:37:40 pm »
If you want to redirect your domain name to sub-directory but the url shows only domain name

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.
Code: [Select]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
RewriteRule    ^$   blog/    [L]
RewriteRule    (.*)  blog/$1 [L]
</IfModule>