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

umerhassan's avatar

Redirect request from ip to domain

I have mapped my forge hosting with godaddy's domain, but still I can access website via ip. How I can redirect requests forcefully from ip to domain?

0 likes
2 replies
Cronix's avatar
server {
    listen 80;
    server_name 123.123.123.123;

    return 301 $scheme://yourdomain.com$request_uri;
}

Add that to your sites nginx config (via forge control panel) substituting the IP and yourdomain.com, up at the top.

Please or to participate in this conversation.