9:00 AM - 22:00 PM
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.
Accessing WordPress by IP is not a common long-term practice, but it serves key development and migration scenarios.
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.
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.
You need to override the domain-based URLs.
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.
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.
Sometimes your web server may block or fail to respond to IP-based access if no default host is set.
Ensure you have a VirtualHost
block like this:
DocumentRoot /var/www/html ServerName 123.123.123.123
Then restart Apache:
sudo systemctl restart apache2
Set a default server block:
server {
listen 80 default_server;
server_name _;
root /var/www/html;
}
Restart Nginx:
sudo systemctl restart nginx
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.
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:
Notepad
as AdministratorC:\Windows\System32\drivers\etc\hosts
123.123.123.123 example.com www.example.com
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.
If your WordPress installation is configured for HTTPS but you’re accessing via HTTP + IP, you may encounter mixed content warnings. To resolve:
https://123.123.123.123
.htaccess
or Nginx configThis 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.
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 | Cons |
---|---|
Fast way to test server environment | Styling and layout issues if URLs not updated |
Useful before DNS points to new host | Not ideal for long-term access |
No need to wait for domain propagation | May cause plugin conflicts |
Accessing WordPress via IP makes sense in these scenarios:
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!
Copyright © 2025 AIRSANG. All rights reserved.