Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

arif's avatar
Level 1

https error

i have purchased a ssl for my site and a dedicated ip and in my hosting i have 12 website without ssl. eg: i purchased a ssl for www.withssl.com and other are without ssl eg: www.withoutssl.com but when i open www.withoutssl.com with https it show the content of my withssl.com website

0 likes
5 replies
bashy's avatar

To stop this, you basically just need to have a catch-all rule. Since you're dealing with HTTPS, you need a certificate/key to be able to return something other than the ONE rule you have for 443 port.

server {
    listen 80 default_server;
    #listen [::]:80 default_server; // uncomment for IPv6

    return 444;
}

server {
    listen 443 ssl http2 default_server;
    #listen [::]:443 ssl default_server; // uncomment for IPv6
    ssl_certificate /etc/nginx/cert/some_self_signed_thing.crt;
    ssl_certificate_key /etc/nginx/cert/some_self_signed_thing.key;

    return 444;
}
arif's avatar
Level 1

@ bashy :- where do i put this code...? in .htaccess..?

bashy's avatar

@arif Well since you haven't stated what web server software you're using, I can't say.

arif's avatar
Level 1

@bashy i m hosting laravel application in justhost shared server (linux). php apache. Is this enough ...?

bashy's avatar

@arif Then you will just need to do the same within the Apache vhost file. If you have trouble doing so, ask their support.

Please or to participate in this conversation.