• 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

old problem: subdomain with www - almost solved

HMnet

Basic Pleskian
old problem: subdomain with www - SOLVED

Hi @all!

I have this old problem: I want to create a subdomain with www. in front of it.

I use Plesk 7.5.3 with SuSe 9.1.

I tried to use DNS settings, but that doesn't really function. As anyone knows. :)

So I testet the version with the vhost.conf file.

This is my vhost.conf:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower
ServerAlias www.<sub>.<domain>.com
RewriteCond %{HTTP_HOST} ^www.<sub>.<domain>.com$
RewriteCond %{REQUEST_URI} !^/home/httpd/vhosts/<domain>/subdomains/<sub>/httpdocs/
#RewriteCond %{REQUEST_URI} !error_docs
RewriteRule (.*) /home/httpd/vhosts/<domain>/subdomains/<sub>/httpdocs/$1
</IfModule>

OK. The browser opens the right site, but PHP is disabled. So the browser wants to download the *.php files.

:eek:

Has anybody a solution for that problem?

Thanx!

HMnet
 
SOLVED!

Hi!

I just figured it out :D.

For anyone who is interested in:

Add the following syntax in your vhost.conf file and you will have a ServerAlias www.<sub>.<domain>.com for your subdomain:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower
ServerAlias www.<sub>.<domain>.com
RewriteCond %{HTTP_HOST} ^www\.<sub>\.<domain>\.com$
RewriteRule ^/(.*) http://<sub>.<domain>.com/$1 [L,R]
</IfModule>

OK, that's it.

HMnet :cool:
 
Yeah, thank you!

Had one customer complaining about the www-before-subdomain-problem today.
This fix made the problem go away easy :)
 
Back
Top