WordPress .htaccess – route other URLs to another app

Since your WordPress site is just a one-page site, this is served from the single URL http://example.com/. You then want http://example.com/<something> to be internally rewritten to http://example.com/app/<something>.

You can add the following mod_rewrite directives before your existing WordPress directives (ie. WordPress front-controller) in your root .htaccess file:

# Route all URL-paths (of 1 or more characters) to CI app
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule (.+) /app/$1 [L]

# WordPress directives start here...
:

The RewriteCond directive that checks against the REDIRECT_STATUS environment variable ensures that only initial requests are rewritten, as opposed to internal rewrites to index.php by WordPress.

The RewriteRule pattern (.+) ensures we only match URL-paths longer than one character, missing the document root – which is passed through to WordPress.