Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk9 min

How to Fix WordPress 404 Errors on Nginx for All Pages but the Homepage

When WordPress’s homepage works but every other URL is 404 on Nginx, the usual cause is a missing /index.php?$args front-controller fallback. Follow this configuration, validation, and troubleshooting guide.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a WordPress homepage loads on Nginx but every post, page, feed, or archive returns 404, the usual cause is a missing front-controller fallback in the active Nginx server block. Change the site’s location / rule to try_files $uri $uri/ /index.php?$args;, confirm that the PHP handler serves the same WordPress installation, test the configuration, reload Nginx, and then retest representative URLs. Nginx does not read Apache-style .htaccess files, so editing one will not repair this routing problem.

What the symptom means

WordPress uses a front controller: requests for dynamic URLs eventually need to reach index.php, where WordPress resolves a slug such as /about/ or /2026/10/example-post/. The homepage often appears to work because /index.php is a real file in the document root. A pretty URL is normally neither a file nor a directory.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When Nginx is configured with a rule such as try_files $uri $uri/ =404;, it checks the filesystem, finds no matching file for the pretty URL, and sends a 404 immediately. WordPress never receives the request. The required fallback is /index.php?$args, which hands unresolved requests to WordPress while preserving query-string parameters.

This is a web-server routing issue, not evidence that every WordPress page has been deleted. A WordPress-generated 404 page is a different failure from an Nginx file-miss response, so identify which layer is producing the response before changing settings.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

The working Nginx pattern

For a normal single-site installation at the web root, the relevant server block has this shape:

server {
    server_name example.com www.example.com;
    root /var/www/example.com/htdocs;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ .php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }
}

Replace the hostname, document root, PHP-FPM socket, and include details with the values used by your system. The important distinction is the final argument in location /: use /index.php?$args rather than an unconditional =404. Keep the try_files $uri =404; guard inside the PHP location. That guard prevents Nginx from passing arbitrary nonexistent PHP paths to PHP-FPM; it does not replace the front-controller fallback in the outer location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The document root must contain the WordPress index.php that the fallback names. The PHP location must pass that file to the PHP-FPM socket or application upstream used by the same site. A correct rewrite paired with the wrong root or wrong PHP handler still produces failures.

Before editing: identify the configuration that is actually serving the site

Nginx may contain several virtual hosts, generated snippets, disabled files, IPv4 and IPv6 listeners, or separate HTTP and HTTPS server blocks. Editing an unused file has no effect. Establish the active path first.

  • Confirm the hostname in the browser matches the server_name of the intended virtual host, including whether traffic uses www or the bare domain.
  • Find the active server block for both the HTTP and HTTPS listeners if the site redirects between them.
  • Check that its root directory contains the WordPress index.php, wp-admin, wp-includes, and wp-content directories.
  • Inspect included files and generated configuration, because a later include or a more-specific location can change request handling.
  • Make a dated backup of the current Nginx configuration and note the previous working version so the change can be rolled back.

On systems that provide a command for dumping the complete loaded configuration, inspect that output rather than relying only on the file you expect to be active. The goal is to see the final server and location rules Nginx has loaded.

Step-by-step repair

1. Open the active server block

Use your distribution’s site configuration layout or hosting control panel to open the server block that handles the affected hostname. Do not create a second, competing server block unless you understand how hostname and listen matching will select it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

2. Correct the outer location

Inside the matching server block, locate the general request handler. For a root installation, it should be:

location / {
    try_files $uri $uri/ /index.php?$args;
}

The order matters. Nginx first serves an existing file, then an existing directory, and only then sends the request to WordPress. Static assets continue to be served directly, while virtual WordPress URLs reach the application.

3. Check the PHP handler

Make sure the PHP location can execute index.php and that SCRIPT_FILENAME resolves under the same document root. A typical handler includes:

location ~ .php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php-fpm.sock;
}

The socket shown is an example. Your operating system or PHP version may use a different socket path or a TCP upstream. Use the endpoint already configured for this site instead of copying a path that does not exist.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Validate syntax before reloading

Run the Nginx configuration test supplied by your installation:

nginx -t

Proceed only when the test reports a successful syntax check. Correct missing semicolons, unmatched braces, duplicate directives, invalid include paths, and conflicting location definitions before attempting a reload. A failed test protects the currently running configuration; do not force a reload with an invalid file.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

5. Reload Nginx

Reload through the service manager used by your host, or use:

nginx -s reload

A reload applies the new configuration without requiring a full machine reboot. If the reload command reports an error, return to the syntax test and service logs rather than repeatedly refreshing the browser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Test more than the homepage

Use a private browser window or a request that bypasses a browser cache. Test a representative set:

Request What it checks Expected behavior
A known page such as /about/ Pretty-page routing The WordPress page loads instead of an Nginx file-miss 404
A published post URL Single-post rewrite rules The post resolves through WordPress
A feed such as /feed/ Non-file application endpoint The feed is returned by WordPress
/wp-admin/ Administrative path handling The login or dashboard endpoint responds
A real static asset Direct file serving The asset is served from disk without being routed through WordPress
The same page with and without a trailing slash Canonical permalink behavior WordPress or its canonical redirect chooses the configured form

If these requests work directly but a public cache still shows the old 404, purge that cache after routing is confirmed. Purging cache cannot repair a missing Nginx fallback.

Why .htaccess instructions do not fix Nginx

The WordPress Advanced Administration Handbook states: “With Nginx there is no directory-level configuration file like Apache’s .htaccess or IIS’s web.config files.” Nginx configuration is applied at the server level, so it does not process rewrite directives stored in a WordPress directory.

Apache tutorials commonly tell you to edit .htaccess after changing the permalink structure. That advice applies to an Apache deployment. On Nginx, the equivalent routing rule belongs in the server block’s location directive. Creating or editing .htaccess may be harmless, but it will not make /about/ reach WordPress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Refresh WordPress’s permalink settings after the server fix

In the WordPress dashboard, open Settings > Permalinks and verify the intended structure. Saving the page can refresh WordPress’s rewrite state. This step is useful after a migration or permalink change, but it cannot substitute for the Nginx try_files rule: WordPress cannot resolve a slug it never receives.

Do not change the permalink structure solely as a routing test if existing links matter. Save the current structure, make the server correction, and then confirm that old and new canonical URLs behave as intended.

Subdirectory installations need a different fallback

If WordPress is installed below the document root, the fallback must include that installation prefix. For an installation in /my_subdir, the pattern is:

location / {
    try_files $uri $uri/ /my_subdir/index.php?$args;
}

The exact location and root arrangement depends on how the site is exposed. Align the URL prefix, filesystem root, static-file locations, and PHP SCRIPT_FILENAME calculation with the documented layout. A root-install rule that points to /index.php can send requests to the wrong application when WordPress actually lives in a subdirectory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test both the prefixed front end and administrative URL, for example /my_subdir/wp-admin/, along with a page and feed under the same prefix.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Multisite requires topology-specific rules

WordPress multisite configurations vary by subdomain versus subdirectory mode, domain mapping, and network layout. The single-site snippet is not a universal multisite configuration. Use the version- and topology-specific Nginx rules for the network, then verify each site’s front end, a post or page, wp-admin, and network administration paths.

Pay particular attention to host matching. A request can reach the wrong server block when several mapped domains share an address, making a seemingly correct rule appear ineffective.

When the 404 remains: diagnose the layer

The request is still an Nginx file miss

Recheck the active hostname, HTTPS server block, and complete loaded configuration. A more-specific location, such as a prefix or regular-expression location, can take precedence over location /. Also confirm that the fallback points to the correct installation and that the file named by the fallback exists under the configured root.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The response is generated by WordPress

If the response has your theme’s 404 template, Nginx may already be routing correctly. Check the requested slug, publication status, language or taxonomy plugins, canonical redirects, and WordPress logs. Do not keep changing Nginx when the application is deliberately returning a 404.

PHP-FPM reports an error

A 502, blank response, PHP fatal error, or application log entry indicates a PHP handler problem rather than a missing rewrite. Inspect Nginx’s error log and the PHP-FPM log, confirm the socket or upstream is running, and verify file permissions and the resolved SCRIPT_FILENAME.

Only cached visitors see 404

Compare a direct request with a cache-bypassing request and inspect response headers. Once the origin returns the correct page, purge the affected page and any reverse-proxy or CDN cache. A cache-management plugin can automate purges, but it does not replace the server-level front-controller rule.

Slash and no-slash forms behave differently

WordPress chooses canonical trailing-slash behavior from the permalink structure. Confirm that redirects are reaching the same server block and that no custom location handles one form separately. Test both forms after every configuration change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Security and operational checks

  • Keep try_files $uri =404; in the PHP location so nonexistent PHP paths are not executed.
  • Do not point root at a parent directory containing multiple applications; use the directory that contains this site’s WordPress files.
  • Preserve existing security headers, access restrictions, and upload handling while changing only the routing line required for the fix.
  • Use configuration backups and a documented rollback. If the new test fails, restore the prior file, run nginx -t, and reload the known-good configuration.
  • After a migration, check ownership and permissions for index.php and the WordPress directories. Permission errors usually appear in logs as access failures, not as a clean rewrite 404.

Choosing how to implement the repair

The right path depends on who controls the running Nginx configuration and PHP stack.

Approach Best fit Capabilities required Main risk to manage
Self-managed repair You administer the server Access to the active server block, ability to run nginx -t, reload Nginx, inspect PHP-FPM, and restore backups Editing an inactive file or breaking another virtual host
Managed WordPress hosting support The host controls Nginx Provide the hostname, affected URLs, timing, and confirmation that the homepage works while other routes fail Assuming a dashboard permalink save can change a server rule the host must edit
Configuration consultant You need custom multisite, subdirectory, or migration work Access to loaded configuration, logs, PHP-FPM or upstream settings, backups, and a rollback plan Applying a generic single-site snippet to a nonstandard topology

Regardless of who performs the change, require the same verification: the active server block is identified, syntax passes, Nginx is reloaded, PHP serves the correct index.php, and representative front-end and administrative URLs are tested.

What to remember

  • The homepage can work because it maps to a real index.php, while pretty URLs need a front-controller fallback.
  • For a root installation, use try_files $uri $uri/ /index.php?$args; in the active location / block.
  • Nginx does not process per-directory .htaccess; the rewrite belongs in server configuration.
  • The Nginx document root and PHP handler must target the same WordPress installation.
  • Subdirectory and multisite deployments need path- and topology-appropriate variants.
  • Validate with nginx -t, reload, test several URL types, and inspect logs before blaming WordPress or a cache.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.