How to Open a WordPress Site by IP Instead of Domain Name

At AirsangDesign, we often work with developers and businesses who need to test or deploy a WordPress site before the domain name is active. Whether you’re working on a staging server, configuring a VPS, or migrating websites, there are times when you must open a WordPress site by IP address instead of its domain name.

This guide walks you through the why, when, and how of accessing your WordPress site via IP, the issues you might encounter, and how to fix them. We’ll also show you how to configure your server and WordPress installation properly to make this setup work temporarily or for internal usage.

Why You Might Need to Access a WordPress Site via IP Address

Accessing WordPress by IP is not a common long-term practice, but it serves key development and migration scenarios.

Common Use Cases

  • Your domain DNS hasn’t propagated yet
  • You’re migrating the site to a new server
  • You’re building a site on a VPS without a configured hostname
  • You want to test SSL-free staging environments

Why This Isn’t Default Behavior

By default, WordPress uses Site URL and Home URL values (usually set in wp_options) that point to your domain. If you try to load the site by IP without updating these, the site will redirect—or worse, break layout and lose styling.

How to Open a WordPress Site by IP Instead of Domain

Here’s how to do it the right way, step by step. These methods assume you already have a WordPress site installed on a server that you can reach via public IP.

Step 1 – Update WordPress Site URL Temporarily

You need to override the domain-based URLs.

Option A – Edit wp-config.php

Add the following lines to your wp-config.php file:

define(‘WP_HOME’,’http://123.123.123.123′);
define(‘WP_SITEURL’,’http://123.123.123.123′);

Replace 123.123.123.123 with your server’s public IP.

This forces WordPress to use the IP as the base URL, bypassing what’s stored in the database.

Option B – Change Values in the Database (not preferred for short-term use)

You can also directly update your database via phpMyAdmin or CLI:

UPDATE wp_options SET option_value = ‘http://123.123.123.123’ WHERE option_name = ‘siteurl’ OR option_name = ‘home’;

Revert these changes later when you’re ready to use the domain.

Step 2 – Ensure Apache or Nginx Accepts the IP Request

Sometimes your web server may block or fail to respond to IP-based access if no default host is set.

Apache Users

Ensure you have a VirtualHost block like this:

DocumentRoot /var/www/html ServerName 123.123.123.123

Then restart Apache:

sudo systemctl restart apache2

Nginx Users

Set a default server block:

server {
listen 80 default_server;
server_name _;
root /var/www/html;
}

Restart Nginx:

sudo systemctl restart nginx

Step 3 – Check Firewall and Port Availability

Make sure port 80 (HTTP) or 443 (HTTPS) is open and not being blocked by your firewall or hosting provider. On most cloud services (like AWS, DigitalOcean, or Vultr), security groups or firewalls must be configured to allow external access.

Optional – Use Hosts File for Domain Simulation

If you want to use your actual domain name even before it propagates (e.g., while it still points to the old server publicly), modify your hosts file locally:

For Windows

  1. Open Notepad as Administrator
  2. Edit the file: C:\Windows\System32\drivers\etc\hosts
  3. Add this line:

123.123.123.123 example.com www.example.com

For macOS/Linux

Edit /etc/hosts using root:

sudo nano /etc/hosts

Then add:

123.123.123.123 example.com www.example.com

This allows only your computer to access the WordPress site by domain—without changing DNS globally.

Common Issues and Fixes

Mixed Content Warnings (HTTPS)

If your WordPress installation is configured for HTTPS but you’re accessing via HTTP + IP, you may encounter mixed content warnings. To resolve:

  • Use a local SSL certificate and access via https://123.123.123.123
  • Or temporarily disable HTTPS redirect in .htaccess or Nginx config

CSS and JS Not Loading

This often happens when the browser blocks resources loading from different domains. Use the WP_HOME and WP_SITEURL method as mentioned earlier, and clear cache/CDN if enabled.

Login Redirects Back to Domain

WordPress login flow checks the Site URL. If it’s set to the domain but accessed via IP, login may redirect to the domain again. The fix? Update the URLs in wp-config.php temporarily.

Pros and Cons of IP-Based Access

ProsCons
Fast way to test server environmentStyling and layout issues if URLs not updated
Useful before DNS points to new hostNot ideal for long-term access
No need to wait for domain propagationMay cause plugin conflicts

When Should You Use IP Access?

Accessing WordPress via IP makes sense in these scenarios:

  • Server setup validation (before DNS switch)
  • Migration testing
  • Internal staging or development servers
  • SSL troubleshooting

Do not use IP-based access long-term on production sites. SEO, plugins, and user trust all depend on domain consistency.

Conclusion: Use IP Access Wisely—Built the Right Way with AirsangDesign

While WordPress was never designed to be accessed by IP alone, with the right configuration and purpose, it’s a powerful option for developers and businesses preparing to launch, migrate, or test.

At AirsangDesign, we help clients configure, launch, and scale WordPress sites in staging, live, and multi-regional environments. Whether you’re working with a domain or IP, we ensure performance, accessibility, and reliability stay intact.

Need help accessing your WordPress site during migration or staging? Let AirsangDesign handle your environment setup with precision and care!

Add comment

Your email address will not be published. Required fields are marked

Enjoy this post? Join our newsletter

Please enable JavaScript in your browser to complete this form.

Don’t forget to share it

Your Best Solution

Related Articles