Hostxpeed
Login Get Started →
Control Panel

How to Set Up Nginx Redirects in HestiaCP

5 min read
25 views
Jun 12, 2026

Prerequisites

Before setting up redirects, make sure you have:

  • SSH access to your VPS
  • Admin access to HestiaCP

Method 1: Add Redirect via HestiaCP Web Interface

Step 1: Log in to HestiaCP

https://YOUR_SERVER_IP:8083

Step 2: Navigate to WEB Section

Click on WEB in the top menu bar.

Step 3: Edit Domain

Click the gear icon (⚙️) next to your domain.

Step 4: Go to Proxy Redirects Tab

Click on Proxy Redirects or Redirects tab.

Step 5: Add Redirect Rule

  • Path: URL path to redirect (e.g., /old-page)
  • Redirect To: Destination URL (e.g., /new-page or https://newsite.com)
  • Type: 301 (permanent) or 302 (temporary)

Step 6: Save

Click Save to apply redirect.

Method 2: Manual Nginx Redirect Configuration

Edit Nginx config:

nano /home/admin/conf/web/nginx.example.com.conf

Add inside server block:

# 301 redirect (permanent)
location /old-page {
    return 301 https://example.com/new-page;
}

# Redirect entire domain to another domain
location / {
    return 301 https://newdomain.com$request_uri;
}

# Redirect www to non-www
if ($host = www.example.com) {
    return 301 https://example.com$request_uri;
}

# Redirect non-www to www
if ($host = example.com) {
    return 301 https://www.example.com$request_uri;
}

# Redirect HTTP to HTTPS
if ($scheme = http) {
    return 301 https://$server_name$request_uri;
}

Common Redirect Examples

Redirect old page to new page:

rewrite ^/old-product$ /new-product permanent;

Redirect entire folder:

rewrite ^/blog/(.*)$ /news/$1 permanent;

Remove .php extension:

rewrite ^/(.*).php$ /$1 permanent;

Test Redirects

curl -I https://example.com/old-page

Look for:

HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page

Restart Nginx

systemctl restart nginx

✅ Nginx redirects have been configured!

Was this article helpful?