• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue non www redirect to www just won't work

Space Monkey

Basic Pleskian
This is driving me bananas!!

I don't have this issue on any of my servers but on this one I just can't get it to work.

I tried literally all .htaccess commanda for non www to www but not one works.

The only redirect that works is Website Domains Names & Hosting | Domain.com to Website Domains Names & Hosting | Domain.com

These give server IP address could not be found error and just won't redirect to Website Domains Names & Hosting | Domain.com no matter what I add in the /htaccess
Code:
http://domain.com
https://domain.com

So I need some assistance because my ADD is driving me nuts with this issue.
 
And what exactly do you add in .htaccess? And is the file named correctly .htaccess?
What type of website do you run? Is this a Wordpress website?
What is set in "hosting settings" in Plesk as the preferred domain?
 
And what exactly do you add in .htaccess? And is the file named correctly .htaccess?
What type of website do you run? Is this a Wordpress website?
What is set in "hosting settings" in Plesk as the preferred domain?
I run 8 servers with plesk and this is the first time I have an issue. By the information I found here and there I think it might have something to do with DNS but not sure.

But yeah, naturally the file name is correct as I run WP sites, it's WP who created the file and everything else in that file works except the redirect non www>www

Although I tested to selec preferred domain www in hosting settings (that's wha tyou mean I think" this feature hasn't work on any of my servers but I was always able to do it through the .htaccess file.
 
And what exactly do you add in .htaccess?
--> unanswered

And is the file named correctly .htaccess?
--> unanswered

What type of website do you run? Is this a Wordpress website?
--> Wordpress

What is set in "hosting settings" in Plesk as the preferred domain?
--> Unanswered or ambigious

So I assume that you have a Wordpress Website. Wordpress stores the domain name in the siteurl and homepage sets of the table *_options (normally wp_options). It will normally redirect the URL to what is stored there, no matter what other settings do. Actually, when another redirect contradicts these settings, you may end up in an infinite redirection loop. I assume that the setting in siteurl and homepage is responsible for the issues that you are describing.
 
Well, he's not answering, but I will:
  • I've set the Preferred Domain to non-www in Hosting Settings in my Plesk admin panel;
  • I have not yet installed WordPress; the site contains the default content (index.html);
  • I created a file in home/httpdocs called ".htaccess ";
  • In that .htaccess file I added:
Code:
                  RewriteEngine On
                  RewriteCond %{HTTP_HOST} ^[URL='http://www.mydomain.com']www.mydomain.com[/URL] [NC]
                  RewriteRule ^(.*)$ [URL]http://mydomain.com/$1[/URL] [L,R=301]
If I browse to...
Code:
 mydomain.com
... I see the default page.

If I browse to...
Code:
 www.mydomain.com
...I see a page not found message.
 
Last edited:
In the end I deleted my test instance and created a new one, and then the Plesk setting worked just fine.
 
Back
Top