简体   繁体   中英

Symfony Ignore Directory in web/

In an symfony project, is there any way to exclude a directory from being processed.

For example, I want to run a seperate php program in mysite.com/other_app

How can I exclude web/other_app folder from being processed by the symfony controller.

I've tried using

RewriteCond %{REQUEST_URI} !^/other_app/(.*)$

and

RewriteCond %{REQUEST_FILENAME} !-d

Symfony still processes the other_app which obviously isn't going to work properly. Any suggestions.Do I need to modify htaccess in other_app/.htaccess as well?

Also, let me add. When I access just the directory mysite.com/other_app I get the correct content. If I try and access anything below that, I get problems.

This works: mysite.com/other_app

This does not: mysite.com/other_app/page1

In the logs I get an error: Action "other_app/page1" does not exist . Or something similar.

Ok. I figured it out. The .htaccess of the sub directory also needs to be modified.

In web/.htaccess use:

RewriteCond %{REQUEST_FILENAME} !-d

In the sub directory, web/other_app/.htaccess use:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /other_app/index.php [QSA,L]

This will work for wordpress and most any other php app that you want to run on a symfony site, but don't want to deal with trying to hack it into the framework.

尝试添加:

RewriteCond %{REQUEST_FILENAME} !-d

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM