2

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 Mar 7 '19 at 22:50
0

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]
</IfModule>
# END WordPress
| improve this answer | |
  • 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. – Mark Kaplun Jul 4 '17 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). – Yaneury Fermin Jul 4 '17 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.