Question Locked

One root folder 2 subdomains

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello everyone
Can someone hint me decision...
I have one root folder in var/www/html/mydomain
and 2 subdomain
1. sub1.mydomain.com
2. sub2.mydomain.com

when I type sub1.mydomain.com in a browser, it opens required index.php.. It os ok
But when I type sub2.mydomain.com it opens the same page, but I need sub2.mydomain.com/tpm/login.php to be opened (login.php located in /var/www/html/mydomain/tpm directory)

How do I fix this simple issue';

3 replies

by kees_b

The server doesn't look in subdirectories (like tpm) for a file called index.php, let alone for a file called login.php. You'll have to program that yourself.

by bhawani1

You can redirect the same using .htaccess file.
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} subdomain\.domain\.com
RewriteCond $1 !^sd_
RewriteRule (.*) /tpm/login.php$1 [L]

This discussion is closed to new replies.