Elxis CMS Forum

Support => General => Topic started by: armpouniotis on November 13, 2022, 22:58:08

Title: Problem with 'www' prefix
Post by: armpouniotis on November 13, 2022, 22:58:08
Hi all,
I have transfered my website to a new server (actually is from Plesk to another Plesk) via ftp.

I have issued Lets Encrypt certificate as well (just like in the previous Plesk).

In the new Plesk: Hosting settings > Preferred domain, I clicked "None" (just like in the old Plesk)

In  configuration.php, the line: "private $URL = 'http://www.zeidoro.gr';", didn't work, so I had to modify it to: "private $URL = 'https://zeidoro.gr';".

This works, but the "www" prefix doesn't appear.

So, I did this:

In Plesk, Hosting settings > Preferred domain I choose "www.zeidoro.gr" and modify the line "private $URL = 'https://zeidoro.gr';" to "private $URL = 'https://www.zeidoro.gr';", but it doesn't work

Is there any solution on that ? I just want the "www" to appear on Chrome's URL line

Thank you in advance
Christos
Title: Re: Problem with 'www' prefix
Post by: webgift on November 15, 2022, 13:27:28
Hello,
i would add the preferred URL in configuration file and the following lines to the .htaccess:
Code: [Select]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
The code above would redirect all non ssl traffic to the ssl one with www. Don't forget to replace yourdomain.com with your own one.

I would finally change all non-www entries in its database with: http://www (http://www). ---> https://www (https://www).

PS: Once i visit the website it seems that it's working as you like.
Title: Re: Problem with 'www' prefix
Post by: armpouniotis on November 15, 2022, 14:01:26
Thank you for reply !

but unfortunately I had to transfer my website to the old server, that's why you see  it in normal situation !

The funny thing is that, it is supposed to run normally on the new server, since the new server is also Plesk, and I didn't do any modifications on any code !

Thank you again for your reply !
Christos
Title: Re: Problem with 'www' prefix
Post by: webgift on November 17, 2022, 08:30:59
You're welcome Christo!