How to fix AIOSEO llms.txt returning 404 in WordPress (WP Cloud / Pressable environments)

If you’ve enabled the llms.txt feature in AIOSEO but your file returns a 404 error at /llms.txt, you’re not alone. This issue commonly appears in hosting environments like WP Cloud where WordPress uses a symlinked core structure.

This guide walks through how to diagnose and fix the issue while keeping your setup update-safe.

Issue background

A WordPress site had AIOSEO’s llms.txt feature enabled, but the file could not be accessed publicly:

  • Expected: /llms.txt loads correctly
  • Actual: 404 Not Found

At the same time:

  • The feature was enabled in AIOSEO
  • The plugin was generating content internally

This indicated the issue was not a simple configuration problem.

Diagnosis

Confirming AIOSEO functionality

Testing confirmed that AIOSEO was generating the llms.txt content correctly within the plugin. This ruled out plugin misconfiguration.

Investigating routing vs file generation

Two possibilities were considered:

  • WordPress routing issue (rewrite rules not handling /llms.txt)
  • File generation path issue (file created in the wrong location)

Root cause

The issue was caused by how AIOSEO writes the llms.txt file using ABSPATH.

In WP Cloud environments, WordPress runs in a symlinked directory structure, meaning ABSPATH does not point to the public web root.

As a result:

  • The file was generated successfully
  • But written to a non-public directory
  • The public URL returned a 404 because the file was not accessible

Resolution steps

Step 1: Confirm hosting environment

This issue is most common in environments where WordPress uses symlinked core files, such as WP Cloud.

Step 2: Verify file location

Check whether the file exists somewhere in the filesystem but not in the public root. Use SSH or a file browser if available.

Step 3: Implement a custom MU plugin

The recommended solution is to create a Must-Use plugin that ensures llms.txt is written to the correct location.

This plugin should:

  • Use AIOSEO’s internal output
  • Write the file to the public document root
  • Avoid modifying plugin core files
add_action('init', function() {
    $content = function_exists('aioseo_llms_output') ? aioseo_llms_output() : '';

    if ($content) {
        $public_path = $_SERVER['DOCUMENT_ROOT'] . '/llms.txt';
        file_put_contents($public_path, $content);
    }
});

Note: Function names may vary depending on AIOSEO version.

Step 4: Keep it update-safe

  • Place the file in /wp-content/mu-plugins/
  • Avoid editing AIOSEO plugin files directly

Step 5: Test accessibility

Visit /llms.txt and confirm the file loads correctly.

Final outcome

  • The issue was caused by a path mismatch, not a plugin bug
  • A custom MU plugin resolved the problem
  • The file is now publicly accessible and update-safe

Key takeaways

  • AIOSEO relies on ABSPATH, which may not align with public paths in all hosts
  • WP Cloud environments require special handling for file generation
  • MU plugins are the safest way to override plugin behavior

If you’re dealing with advanced WordPress SEO or hosting issues like this, contact Freshy.