• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How do I ... add a Subdomain to the Domain?

A

ArthurDent

Guest
Hi!

I've already searched the forum but haven't found an appropriate solution. My problem: I want to add a subdomain to my Domain like "de.domain.com" that IS the normal domain "domain.com".

I don't want to forward to the domain with PHP or HTML, I don't want to "rewrite" it and I don't want an extra directory for it.

Actually I just wanna tell Plesk, that "de.domain.com" and "domain.com" are the same.

So, how do I do it?

Any help is highly appreciated!

Cheers
 
I don't want to forward to the domain with PHP or HTML, I don't want to "rewrite" it and I don't want an extra directory for it.

Any particular reason why not? The easiest method of doing this is to use at least one file to bounce to the other. The alternative is to rewrite your Apache configuration files but this is easier said than done because Plesk rewrites many files
 
Well, I want to use the subdomain to indicate the language. The website is written in php and should detect the language by the used subdomain.

So a rewriting or forwarding isn't possible as the subdomain disappears and is replaced by the normal "www". I eventually use the Rewrite-Engine to do some rewriting for the parameters as well...

If there isn't any other way, I'll simply add the subdomain in PLESK and symlink the httpdocs of the "domain.com" ...

Thanks
 
I was a bit hasty in my previous reply. Here's the downside to what you propose.

When you make a subdomain in Plesk it overwrites the httpd.include file in your conf directory and adds an entry. It's in this entry that your home directory is set. I know that you can override settings in here by using vhost.conf but I don't think that the scope of vhost.conf encompasses base directory settings.

What you can try is copying the VirtualHost block for your subdomain from that httpd.include file and pasting it into a conf file in your /etc/httpd/conf.d. Name it something starting with a z (like z-domain.conf). Then make your edits. Plesk won't overwrite this file and hopefully Apache, having read it last, will use its settings over the ones set by Plesk. Just be aware that this could break Apache so use it with caution.
 
Originally posted by Highland
I
What you can try is copying the VirtualHost block for your subdomain from that httpd.include file and pasting it into a conf file in your /etc/httpd/conf.d. Name it something starting with a z (like z-domain.conf). Then make your edits. Plesk won't overwrite this file and hopefully Apache, having read it last, will use its settings over the ones set by Plesk. Just be aware that this could break Apache so use it with caution.

That's actually a nice idea, but I don't want to modify the server configuration that much. It'll be very hard to restore and remind it in case of a server crash (we're having a crash quite often). So I'd actually prefer a very simple and easy-to-restore/remind method.

And actually it's a shame, that PLESK doesn't offer it. Sharing the same webspace should be the easiest thing for the server instead of creating special directories ...

Anyway, thanks for your ideas :)
 
Utilizing the vhost.conf directive, along with "ServerAlias", you should be able to complete the task you're working with. You'll still need to create the DNS records within plesk, but the vhost.conf should do the rest (as for the site appearing). You should be able to parse the server_name through php to identify what server name they used to access the site (thus allowing you to modify the language settings, as you're wanting to do).

As for the statement regarding you having crashes regularly..that's a serious issue. Anyone hosting any site knows that having an issue with continuous crashes of the system needs to be addressed. I'd suggest directing all of your attention towards your issues with stability and reliability before expanding in multiple directions with language supports...

Edit: (For assistance with vhost.conf, please use the "Search" feature at the top of the Forums. The lines you will want to add to your configuration will be "ServerAlias de.server.com" etc.)
 
Hi!

Thanks for your tip. I've already tried to work with the vhost.conf and actually set up the ServerAlias but didn't specify the DNS via PLESK. I'll try it :)

Regarding the server issue: we're working on it :)

Thanks and Cheers,
chris
 
How do I exactly do it? I've just specified the DNS and it shows up like
de.domain.com. CNAME domain.com

But it doesn't work ... de.domain.com just shows the PLESK "domain not found" default page ...

I'm not an Admin so I'm not sure whether I did it right. The vhost.conf just contains the following line:
ServerAlias de.domain.com

Is this right?

Hope, you can help me!

Cheerio
 
Back
Top