How to Preview a Local DDEV WordPress Website on iPhone, iPad, and Android (Over Wi-Fi)

Photo of a laptop, tablet, and smartphones on a desk testing a local website over Wi-Fi, next to vertical text "PREVIEW A DDEV WORDPRESS SITE ON MOBILE (OVER WIFI)" on a white background.

How Do You View a Local DDEV WordPress Site on Mobile?

To preview a local DDEV WordPress website on an iPhone, iPad, or Android device over Wi-Fi, you need to bind DDEV to your local network interface, attach a wildcard nip.io domain to your project, and update WordPress’s site URLs using WP-CLI.

Specifically, follow these four steps:

  1. Find your computer’s local Wi-Fi IPv4 address.
  2. Run ddev config global --router-bind-all-interfaces and add yourproject.<YOUR-IP>.nip.io via --additional-fqdns.
  3. Add dynamic WP_HOME and WP_SITEURL rules to wp-config.php.
  4. Run ddev wp search-replace so internal WordPress links load properly on mobile browsers without redirecting back to .ddev.site.

Why Can’t Mobile Devices Open .ddev.site Links Directly?

When you build a WordPress website locally using DDEV, your site lives at a local domain such as [https://mysite.ddev.site](https://mysite.ddev.site). DDEV automatically maps this domain to 127.0.0.1 (localhost) inside your computer’s hosts file.

However, your iPhone, iPad, or Android phone does not read your computer’s hosts file. When you type mysite.ddev.site into Safari or Chrome on a mobile device, the phone looks on the public internet, finds nothing, and returns a “This site can’t be reached” error.

By using local Wi-Fi routing combined with nip.io (a free wildcard DNS service that maps hostnames directly to IP addresses), your mobile devices can communicate directly with your computer’s DDEV server at zero latency.

Prerequisites Before You Start

Before running any commands, check these three items:

  • Same Wi-Fi Network: Your Mac or Windows PC and all mobile devices (iPhone, iPad, Android) must be connected to the exact same Wi-Fi network.
  • Avoid Guest Wi-Fi: Standard home or office Wi-Fi works best. “Guest” Wi-Fi networks often enable Client Isolation, which blocks devices from communicating with each other.
  • Working Local Project: Your DDEV WordPress project should already be running smoothly on your computer.

Step-by-Step Guide: Test Your DDEV WordPress Site on Mobile

Step 1: Find Your Computer’s Local Wi-Fi IP Address

First, open your terminal inside your DDEV project folder and find your computer’s local IPv4 address.

  • On macOS (Terminal):Bashipconfig getifaddr en0
  • On Windows (PowerShell):PowerShellGet-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -match "Wi-Fi" } | Select-Object IPAddress

Write down the IP address that appears (for example, 192.168.1.12).

Step 2: Configure DDEV to Accept Local Wi-Fi Connections

By default, DDEV blocks incoming requests from outside your computer for security. You need to allow DDEV’s router to listen to your local Wi-Fi network and register a nip.io domain for your project.

Run the following commands in your project terminal (replace mysite with your project name and 192.168.1.12 with your actual IP address from Step 1):

Bash

ddev config global --router-bind-all-interfaces
ddev config --additional-fqdns=mysite.192.168.1.12.nip.io
ddev poweroff && ddev start

Tip: If macOS or Windows shows a firewall popup asking whether to allow incoming network connections for Docker or DDEV, click Allow.

Once ddev start finishes, you will see [http://mysite.192.168.1.12.nip.io](http://mysite.192.168.1.12.nip.io) listed among your active project URLs.

Step 3: Make WordPress Respond Dynamically to Both URLs

WordPress checks its configuration to verify the domain name before loading a page. To prevent WordPress from forcing mobile visitors back to .ddev.site, add a dynamic URL rule to your wp-config.php file.

  1. Open your project’s wp-config.php file in your code editor.
  2. Scroll down just above the line that says /* That's all, stop editing! Happy publishing. */ (or above require_once __DIR__ . '/wp-config-ddev.php';).
  3. Paste these two lines of PHP:PHPdefine('WP_HOME', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']); define('WP_SITEURL', WP_HOME);
  4. Save the file.

Step 4: Update Internal Database Links for Mobile Testing

Even with wp-config.php updated, WordPress stores hardcoded URLs ([https://mysite.ddev.site/](https://mysite.ddev.site/)...) inside its database for navigation menus, page links, and images. Without updating them, your homepage will load on mobile, but tapping any menu link will fail.

  1. (Optional) Export a quick database backup for peace of mind:Bashddev export-db --file=backup-before-mobile.sql.gz
  2. Swap the URLs safely using WP-CLI (replace mysite and 192.168.1.12 with your details):Bashddev wp search-replace "https://mysite.ddev.site" "http://mysite.192.168.1.12.nip.io" --all-tables ddev wp cache flush (If you build with Elementor, also run ddev wp elementor flush-css so stylesheets and background images load cleanly.)

Is wp search-replace safe? Yes. WP-CLI runs inside DDEV’s Linux container and automatically handles serialized PHP arrays used by WordPress menus, widgets, and page builders without breaking your database.

Step 5: Open the Website on Your iPhone, iPad, and Android

Grab your iPhone, iPad, or Android device, open Safari or Chrome, and enter the HTTP address (make sure to use http://, not https://):

Plaintext

http://mysite.192.168.1.12.nip.io

Your local WordPress site will load over Wi-Fi, and you can tap through pages, test responsive breakpoints, and check touch interactions across all your devices.

Step 6: Revert Your Database Back to Desktop Mode When Finished

Once you finish testing on mobile and want to return to normal desktop development on [https://mysite.ddev.site](https://mysite.ddev.site), run the exact reverse command in your terminal:

Bash

ddev wp search-replace "http://mysite.192.168.1.12.nip.io" "https://mysite.ddev.site" --all-tables
ddev wp cache flush

Your database is now back to its original state.

Troubleshooting Common Mobile Preview Issues

IssueLikely CauseQuick Fix
“This site can’t be reached” on mobileYou typed https:// instead of http://, or devices are on different Wi-Fi bands/networks.Ensure the URL starts with http:// and verify all devices are on the same main Wi-Fi network.
Homepage loads, but clicking menu links failsHardcoded .ddev.site URLs are still stored in the WordPress database.Re-run the ddev wp search-replace command from Step 4 and flush your browser cache.
Missing CSS styles or background imagesPage builder cache (like Elementor) still references the old .ddev.site domain.Run ddev wp elementor flush-css or regenerate CSS from your WordPress dashboard.
Connection times out on WindowsWindows Defender Firewall is blocking incoming port 80 traffic on Public networks.Set your Wi-Fi network profile to Private in Windows Settings and allow Docker Desktop through the firewall.

Frequently Asked Questions (FAQ)

Do I need internet access to use nip.io?

Your mobile device needs an active internet connection briefly to perform the DNS lookup for nip.io, which resolves the domain to your local IP address (192.168.x.x). Once resolved, all website traffic travels directly over your local Wi-Fi router without using external bandwidth.

Why should I use http:// instead of https:// when testing on mobile?

DDEV uses mkcert to generate local SSL certificates that only your computer trusts. Mobile browsers like iOS Safari and Android Chrome will block https:// connections to unverified local certificates, whereas http:// loads immediately without certificate warnings.

Will ddev wp search-replace work on both macOS and Windows?

Yes. Because ddev wp executes WP-CLI inside DDEV’s Docker container rather than on your host operating system, the exact same commands work identically on macOS, Windows, and Linux.

Facebook
Twitter
LinkedIn

Other Posts