IndianWebPortal.com

Something Different In Linux

Home » Email Marketing Series » 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

One Response so far.

  1. zerodtkjoe says:

    Thanks for the info


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...