• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Domain Alias [Web Service] redirect to www version

fabrizioi

Basic Pleskian
Hi All,

I have a subscription configure in the following way:

domain.com
domain.it [Host Alias]
domain.eu [Host Alias]

I have defined for the domain.com the preferred domain www.domain.com .

this works fine for domain.com, all request from domain.com will be seo-safe redirect to www.domain.com .

The problem is that host alias does not permit config of the preferred domain in "web service mode". (this is needed to maximize seo and offer the same site in other language for example)

So I have tried to resolve the issue via .htaccess

Apache config:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

or as reccomanded for apache 2.4

Code:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ %{REQUEST_SCHEME}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Both works fine except for top level domain request e.g. https://domain.it or https://domain.eu: redirection not works.
Works for example https://domain.it/contact/show this is redirect to https://www.domain.it/contact/show

Can I resolve it in vhost.conf via Redirect Permanent or there are other ways ?

As for apache 2.4, the Redirect method from mod_alias seem to be the reccomanded way:

Any help was appreciated.

Regards

Fabrizio
 
I would just create separate domains for domain.it and domain.eu (no aliases) and configure these to redirect to domain.com

You can do this using the standard Plesk redirect or a .htaccess 302 redirect.
 
I would just create separate domains for domain.it and domain.eu (no aliases) and configure these to redirect to domain.com

You can do this using the standard Plesk redirect or a .htaccess 302 redirect.

Hi,

Thanks for the reply.

I have not completly understand the way suggested.

Did you mean to add domain to the current subscription insteadof host Alias (or both) ?

Regards

Fabrizio
 
Use no Alias, just "Add domain" in that subscription and configure it to do forwarding.
 
Ok, but forwarding mantain the original domain.

This is an ambiguous statement. I would say that "normal forwarding" does NOT maintain the original domain you entered.
So it doesn't make it clear to me if you're mistaken or that you are wording it a bit clumsy.
I suspect your wording is merely a bit clumsy.

Anyhow,
If you enter the URL "domain.it" in your browser, the web server will direct your browser to go to "domain.com".
You will see this change in the address field of your browser. It will state "domain.com"

If you use "frame forwarding", that address field will not change and it will continue to state: "domain.it"

1600250843292.png
 
Last edited:
Ok, but forwarding mantain the original domain.

This is an ambiguous statement. I would say that "normal forwarding" does NOT maintain the original domain you entered.
So it doesn't make it clear to me if you're mistaken or that you are wording it a bit clumsy.
I suspect your wording is merely a bit clumsy.

Anyhow,
If you enter the URL "domain.it" in your browser, the web server will direct your browser to go to "domain.com".
You will see this change in the address field of your browser. It will state "domain.com"

If you use "frame forwarding", that address field will not change and it will continue to state: "domain.it"

View attachment 17536
Hi,

Sorry If I'm not very clear, you are right. I'm refer to the 3th option.

I have never used this option, because I always thought it could create phishing or indexing problems, because of the frame.

I will read the documentation about it.

Thank you very much for your help.

Regards

Fabrizio
 
Hi All,

After some test I have resolved and fix the issue.

The problem was that if the rule defined to redirect domain.it to www.domain.it is referred to a domain alias, the rule must be placed prior to the following rules.
Apache config:
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]

Now everithing works fine.

Regards

Fabrizio
 
Back
Top