I have a web application developed in flutter in the folder /app. I would like to install Wordpress on to host all the regular content pages. However, when a user interacts with the /app pages, Wordpress interferes and throws a Page not Found error.
The suggested "solution" places the app in an iFrame, which creates its own issues.
Therefore, I am trying to exclude the /app sub folder from WP processing.
You can exclude /app from WordPress processing by updating your .htaccess file (if you're using Apache).
Default wp .htaccess block
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ - [L]
#This sends everything else to WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#END WordPress
Edit this version like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ - [L]
#Bypass WordPress for /app and its subpaths
RewriteCond %{REQUEST_URI} ^/app [NC]
RewriteRule ^ - [L]
#This sends everything else to WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#END WordPress
RewriteCond %{REQUEST_URI} ^/app [NC]
Checks if the requested URL starts with /app (case-insensitive).
RewriteRule ^ - [L]
If yes, it stops rewriting, meaning WordPress won’t process it. It leaves the request to be handled by your Flutter app's files.