Linux

Question

One root folder 2 subdomains

By vusald ·
Tags: Software, Linux
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';
Thread display: Collapse - | Expand +

All Answers

Collapse -

Re: login.php

by Kees_B Moderator In reply to One root folder 2 subdoma ...

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.

Collapse -

use .htaccess

by bhawani1 In reply to One root folder 2 subdoma ...

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]

Collapse -

Do not use

by StevenTillson02 In reply to One root folder 2 subdoma ...

Do not use the same folder for the same domains .

Related Discussions

Related Forums