Basically, I have a website built that has two components. One component is the the WordPress part, under "/". And the second component is a Symfony app under "/foo". How can I make Word-press ignore the "/foo" route and redirect that to the Symfony app?

I assume that I have to use an .htaccess file to accomplish (website will run on Apache) this, but I am not too well-versed in the syntax.

Helpful Info:

  • Wordpress Version 4.8 Symfony Version 3.3 Apache 2.4
  • Is my assumption right that you don't have an index.php file in your /foo directory? Maybe you add one redirecting to to app.php and it should work out of the box without any htaccess or other modifications.
    – chrisbergr
    Commented Mar 7, 2019 at 22:50

1 Answer 1


Update your .htaccess in WordPress root folder with below code

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foo
RewriteRule ^/foo/app\.php$ - [L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
  • 1
    while probably correct it is not a great idea to do it inside the # BEGIN WordPress block as it might be overwritten when wordpress regenerates the htaccess rules. Commented Jul 4, 2017 at 16:57
  • It works in that it redirects to the proper directory. But it doesn't execute web/app.php . It just displays the content of the directory (the entire source code of the web app).
    – user123146
    Commented Jul 4, 2017 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.