I want dynamically points sub domain to sub directory through htaccess without changing the urls and directory listing shows below.
|-- Test (Root Directory) <-- test.com redirects to this folder.
|-- index.php
|
|-- subdomain (Directory)
|
|---- abc (Directory) <-- abc.test.com redirects to this folder.
|------ index.php
|
|---- pqr (Directory) <-- pqr.test.com redirects to this folder.
|------ index.php
|
|---- xyz (Directory) <-- xyz.test.com redirects to this folder.
|------ index.php
I have applied following rewrite rule to points subdomain.
.htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.test.com
RewriteRule (.*) http://test.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^test\.com $
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1
RewriteCond %{HTTP_HOST} ^(^.*)\.test.com
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1
I am not that much good in htaccess rewrite.
I have follow this subdomain on the fly
But I couldn't succeeded. Your suggestions are highly appreciated.
Thanks.