Jarvis

WordPress Integration

Serve your AEO blog at yourdomain.com/blog on WordPress using the Rewrite strategy.

This uses the Rewrite integration strategy: a /blog folder in your WordPress root intercepts requests and reverse-proxies them to AEO. Three steps. Replace {brand_slug} with your own brand slug in index.php — it is the first segment of your platform blog URL, app.aeo.how/{brand_slug}/blog.

1

Install a file-manager plugin

Install a plugin that lets you edit files from the WordPress admin, for example WP File Manager (https://vi.wordpress.org/plugins/wp-file-manager/).

2

Create a blog folder inside public_html

Open the file manager and create a new folder named "blog" inside public_html.

3

Add these two files inside /blog

File name: .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /blog/index.php [L]

File name: index.php

<?php
/**
 * AEO Blog Proxy — reverse proxy /blog to AEO platform
 */
$path = parse_url($_SERVER['REQUEST_URI'] ?? '/blog', PHP_URL_PATH);
$target = 'https://app.aeo.how/{brand_slug}' . $path;

if (!empty($_SERVER['QUERY_STRING'])) {
  $target .= '?' . $_SERVER['QUERY_STRING'];
}

$ch = curl_init($target);
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HEADER => true,
  CURLOPT_SSL_VERIFYPEER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_HTTPHEADER => [
    'X-Forwarded-Host: ' . ($_SERVER['HTTP_HOST'] ?? ''),
    'X-Forwarded-Proto: https',
    'X-Forwarded-For: ' . ($_SERVER['REMOTE_ADDR'] ?? ''),
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language: ' . ($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'vi,en;q=0.5'),
    'User-Agent: ' . ($_SERVER['HTTP_USER_AGENT'] ?? 'AEO-Blog-Proxy/1.0'),
  ],
]);

$response = curl_exec($ch);

if (curl_errno($ch)) {
  curl_close($ch);
  http_response_code(502);
  echo 'Blog temporarily unavailable.';
  exit;
}

$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$headers_raw = substr($response, 0, $header_size);
$body = substr($response, $header_size);
curl_close($ch);

http_response_code($http_code);

$safe = ['Content-Type', 'Cache-Control', 'ETag', 'Last-Modified', 'X-Robots-Tag'];
foreach (explode("\r\n", $headers_raw) as $line) {
  if (stripos($line, 'Location:') === 0) {
    $location = trim(substr($line, 9));
    $location = preg_replace('#^https?://app\.aeo\.how#i', '', $location);
    $location = str_replace('/{brand_slug}/blog', '/blog', $location);
    header('Location: ' . $location, true, $http_code);
    continue;
  }
  foreach ($safe as $allowed) {
    if (stripos($line, $allowed . ':') === 0) {
      header($line);
      break;
    }
  }
}

$body = str_replace('/{brand_slug}/blog', '/blog', $body);
echo $body;

Replace {brand_slug} with your own brand slug in both the $target URL and the str_replace line near the bottom.

This guide puts the Jarvis blog on your WordPress domain (Option 2: Jarvis blog on your domain). To publish articles straight into WordPress instead, use Option 1: Publish into your website on Blog → Connect website.

WordPress Integration | Jarvis AEO/SEO Help