Published:
April 17, 2009How to redirect domain to other directory on the same domain
Open the .htaccess file of your root directory
of your project and add the following line.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^http://someDomainName.com [NC]
RewriteCond %{HTTP_HOST} !^http://www.someDomainName.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} !^/someOtherDirectory/
RewriteRule ^(.*)$ /someOtherDirectory/$1
Then restart your apache
Usage :
Suppose your project is placed in some other directory
other than the default web directory then you can redirect
your request to that directory for example
Your actual project URL is
"http://someDomaiName/someDirectory/fileName"
and you want that your URL should resemble like
"http://someDomaiName/fileName"
then the above .htaccess rule will do the same.