• 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.

Question Redirect root domain and all wildcard subdomains to specific subdomain

molmagman

New Pleskian
Here is my problem.

Say I have a domain bestwebsite.com but I want all traffic to redirect to the.bestwebsite.com, even from the root domain. This is the company name.
I have set up one subscription for bestwebsite.com with a wildcard SSL certificate.
I can make bestwebsite.com redirect to the.bestwebsite.com using the following .htaccess file...

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^the\.bestwebsite\.com$ [NC]
RewriteRule ^(.*)$ https://the.bestwebsite.com/$1 [R=301,L]

...but my site is hosted in a subscription for bestwebsite.com so the.bestwebsite.com is not found and redirection from anything other than the root domain does nothing :(

BTW - bestwebsite.com is not my real domain :)

I'm using Plesk Obsidian on a VPS from IONOS but I have access to the DNS settings and file system.
 
Maybe the Rewrite is unnecessarily difficult for what you wish to achieve. You could put
Code:
Rewrite 301 / https://the.bestwebsite.com/
into your .htaccess file to redirect all.
 
Maybe the Rewrite is unnecessarily difficult for what you wish to achieve. You could put
Code:
Rewrite 301 / https://the.bestwebsite.com/
into your .htaccess file to redirect all.
Wouldn't that result in a redirect loop?
 
When the user puts the code into his main domain, it will simply redirect to the subdomain. The subdomain is not affected by it. Unless however, the user has created the document root directories of his subdomain branching off the document root directory of his main domain. But the default configuration is that each domain and subdomain has their own subdirectory branching off the user's home.
 
Back
Top