Use Apache for serious .well-known files. Use WordPress only when you need a quick fix or a plugin already handles the job well. The simple rule is this: if a robot, app store, certificate tool, or security scanner needs the file, keep WordPress out of the way.
TLDR: Apache is faster, cleaner, and safer for managing .well-known files. WordPress is easier for beginners, but it can break when plugins, redirects, or caching get involved. For example, a small shop with 12,000 monthly visits may lose certificate renewal for 6 hours if an ACME challenge gets redirected by WordPress. If uptime matters, serve /.well-known/acme-challenge/ straight from Apache.
What is the .well-known directory?
The .well-known directory is a special folder on your website. It sits at the root of your domain.
Like this:
https://example.com/.well-known/
It is used by browsers, apps, search tools, certificate systems, and security services. They know where to look. No guessing. No hunting through random pages.
Common files include:
- ACME challenge files for SSL certificates.
security.txtfor security contact details.assetlinks.jsonfor Android app links.apple-app-site-associationfor iOS app links.- OpenID and WebFinger files for identity tools.
These files must be easy to reach. They must return the right status code. They must not be replaced by a pretty WordPress 404 page. That is where the trouble starts.
WordPress: friendly, but a bit nosy
WordPress likes to handle web requests. That is its job. A visitor asks for a page. WordPress checks rules, loads plugins, builds the output, and returns a page.
That is great for blog posts. It is not great for tiny verification files.
A request for this:
https://example.com/.well-known/security.txt
may pass through WordPress if Apache is not set up to serve the file first. Then plugins can interfere. Redirect plugins may change the URL. Security plugins may block the path. Caching plugins may serve old content. SEO plugins may add headers you did not ask for.
Honestly, it feels like asking a hotel manager to hand you a sticky note from the front desk, and they call a meeting first.
When WordPress makes sense
WordPress can still be useful. It is not the villain. It is just not always the best tool for this job.
Use WordPress when:
- You do not have server access.
- Your host blocks direct file changes.
- You use a trusted plugin for one clear task.
- The file is not critical for uptime.
- You need a non-technical editor to update content.
For example, a plugin that manages security.txt can be handy. Your legal or security contact may change. A dashboard field is easier than SFTP for many teams.
Still, test the result. Open the URL in a private browser window. Check the raw file. Use a header checker. Make sure it returns 200 OK, not a redirect chain that does three cartwheels before loading.
Apache: boring in the best way
Apache is closer to the metal. It can serve files before WordPress wakes up. That makes it fast and reliable.
If the file exists here:
/public_html/.well-known/security.txt
Apache can send it directly to the browser. No theme. No plugin. No database query. No surprise email from a monitoring tool at 2:13 a.m.
This is why Apache is the better choice for:
- SSL certificate validation
- App ownership checks
- Security policy files
- Identity verification
- Machine-read files
Those systems are picky. They do not care that your homepage looks nice. They want one file. At one path. With one clean response.
The main fight: control vs comfort
This is the real WordPress vs Apache choice.
- WordPress gives comfort. You click buttons.
- Apache gives control. You set exact rules.
Comfort is nice. Control saves pain.
Expect to waste time on strange bugs if WordPress handles every .well-known request. One redirect rule can break Android app links. One cache setting can serve an old file. One security plugin update can block hidden folders because they start with a dot.
That dot matters. In Unix-style systems, folders that begin with a dot are often treated as hidden. Some tools get suspicious. Some hosts block them by default. Apache can be told, very clearly, to allow access.
A simple Apache setup
If you manage Apache, your goal is simple. Let real .well-known files load directly. Let everything else go to WordPress.
A common .htaccess idea looks like this:
RewriteEngine On
RewriteRule ^\.well-known/ - [L]
# WordPress rules below
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
This tells Apache, “If the request starts with .well-known/, stop rewriting it.” WordPress does not get involved.
Some servers also need permission rules. For example:
<Directory "/var/www/example.com/.well-known">
Require all granted
</Directory>
Your host may use a different setup. Shared hosting often limits Apache config access. In that case, .htaccess may be your main option.
What can go wrong?
Plenty. Annoyingly small things can cause big failures.
- Redirects:
httptohttpsis fine. Five redirects are not. - Wrong MIME type: JSON files should be served as JSON when possible.
- Blocked dot folders: Some security rules deny access.
- WordPress 404 pages: A pretty error page is still an error.
- Cache delay: Old verification files may sit around too long.
- File name mistakes: Apple’s file has no
.jsonending.
That last one catches many people. The iOS file is usually:
/.well-known/apple-app-site-association
Not:
/.well-known/apple-app-site-association.json
It drives me crazy that one tiny extension can break app links for a whole team. But that is how these systems work.
Performance difference
The performance gap is not huge for one request. But it exists.
Apache can serve a small text file in a few milliseconds. WordPress may need PHP, plugins, theme loading, and database calls. That can turn a 5 ms file request into 150 ms or more.
For humans, that may not matter. For automated checks, it can. For busy sites, it also adds waste. If 20,000 bots request verification and policy files each month, WordPress should not be doing extra work for each one.
Best practice: split the work
The best setup is not dramatic. Let each tool do what it does best.
- Use Apache for fixed files and validation paths.
- Use WordPress for content and admin-friendly updates.
- Test each URL after changes.
- Keep backups of working files.
- Document ownership so nobody deletes the folder by mistake.
If a plugin creates a .well-known file, check where it lives. If it only simulates the file through WordPress routing, be careful. That may work today. It may fail after a plugin update.
Quick decision guide
- Need SSL renewal? Use Apache.
- Need Android app links? Use Apache.
- Need Apple app association? Use Apache.
- Need editable security contact info? WordPress is okay.
- No server access? WordPress plugin may be your only path.
- Running a business site? Ask the host to allow direct files.
Final answer
Apache should manage your critical .well-known files. It is direct, fast, and less likely to meddle. WordPress is useful when humans need an easy interface, but it adds moving parts.
If you want fewer weird errors, serve the files from the server. Then let WordPress do what it does best: pages, posts, users, forms, and the usual website circus.