Help - Search - Members - Calendar
Full Version: Creating REAL vhosts as subdomains
The Planet Forums > Control Panels > Plesk
cherche1pseudo
I was really disappointed with plesk because, as i want to create a subdomain, i have to make another hosting account. I mean the folder is not a child of the main domain.

Actually, i want to preserve my website subdomains configuration but i still not succeed in.
My main domain (domain.net for the eg) is hosted in .../httpdocs/
My others subdomains (sub.domain.net) are hosted in .../httpdocs/sub/

I tried with the httpd.conf, httpd.include (generated by plesk) and i don't succeed. I guess it is possible but ...


So thanks by advance

PS : i read some tutorials which were explaining with the wildcard trick but the subdomain created in DNS was still not active 2 days later (and i tested it with a .info domain, few minutes only are needed).


PPS : i saw Qmail, what is it : the mail admin or a mail daemon ?
cherche1pseudo
4PSA suggested the idea of one of his script but i find really crazy to pay for something which is usually available ...
No one knows a real way to make vhosts without paying ?

It's so crazy ... i don't want to recode a major part of my website only for that .
LittleBrother
/*---------------------------------------------------
/ Unlimited subdomains in PLESK
/ (might work somwhere else but not tested)
/ works fine with REDHAT9 / PLESK6
/
/ Go to the PLESK admin and select dns, add:
/ *.. A
/ Put this file in /home/httpd/vhost/default/htdocs/
/ name it index.php
/ Thats all!
/
/ Greets Bart
/-----------------------------------------------------
*/

// Get the hostname typed in
$subhost = strtolower($HTTP_HOST);
// Get the subdomain
$subdomain = str_replace("http://", "", $subhost); // loose the http://
$subdomain = str_replace("www.", "", $subdomain); // loose www. if there is one
$final = ereg_replace(".[0-9A-Za-z]+.[0-9A-Za-z]+", "", $subdomain); // and loose the domain

// Get the domain only
$host = ereg_replace("^[0-9A-Za-z]+.", "", $subdomain); // loose the subdomain
$host = ereg_replace("/[0-9A-Za-z/.]+$", "", $host); // loose everyting after including the first /

// Redirect them
header("Location: http://www.".$host."/".$final);.
// thats all
// improvements are welcome...
?>
LittleBrother
in this way all directorys created in httpdocs are also accesible as subdomain.

http://www.mydomain.com/sales/ == http://sales.mydomain.com

improvements are welcome here

[edit]
i just have this idea, you can probaly adjust this script so the subdomain is loaded in a frame, this way the http://sub.domain.com stays in the urlbar

need for sleep
[/edit]
cherche1pseudo
Hm thanks for this option but it is not very good for me and my friend Google ^^ actually i must have subdomains and not redirections.

I think i'll have to pay to have something that should have been natural ...
Squire
I've never tried it myself because I happen to like having sub-domains be separate entities (that's exactly how Google views them btw, so it's not just Plesk), but you should be able to do use Mod_Rewrite to do what you want. Just do a replace on the sub (if it's not "www") and replace it with a variable that is your sub's name/folder.

That'll be just fine with Google too since it's done at the server level. I do exactly the same thing on the other end of the URL with tons of shopping cart sites that have too many modifiers so that they'll get spidered and indexed.

Squire
cherche1pseudo
Yep i tried to modify the httpd.conf with Aliases & cie but nothing to do.

Actually i know subdomains are independant websites for Google so it is why i need to use them. But the problem is that thoses "independant" sites are link to the first as "modules". Working really independantly would mean to change a lot of things and i don't have time to do so. Perhaps later.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.