How to redirect domain to subdirectory without redirecting url

f 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.

<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>

It is easy but to perform this task you need to consider one of the hostripple web hosting plans and 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.
  • 165 Users Found This Useful
Was this answer helpful?

Related Articles

Can I use my domain name or must I use my IP address as the hostname for FTP?

Using your IP address (192.168.22.22  is an example IP address) is the preferred entry for...

Can you transfer my sites from my current host to my new VPS?

Yes. We will transfer all of your sites free* of charge and will assure that you experience no or...

Do you allow MP3 files? Do you allow streaming of videos?

Yes we do with our special plans at http://hostripples.in/avs-hosting.php

Do you support Cold Fusion?

We do not support or Cold Fusion on our shared hosting servers, however you are more than welcome...