[英]Symfony Ignore Directory in web/
In an symfony project, is there any way to exclude a directory from being processed. 在symfony项目中,有什么方法可以排除目录。
For example, I want to run a seperate php program in mysite.com/other_app 例如,我想在mysite.com/other_app中运行单独的php程序
How can I exclude web/other_app folder from being processed by the symfony controller. 如何排除symfony控制器正在处理的web / other_app文件夹。
I've tried using 我试过使用
RewriteCond %{REQUEST_URI} !^/other_app/(.*)$ RewriteCond%{REQUEST_URI}!^ / other_app /(.*)$
and 和
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond%{REQUEST_FILENAME}!-d
Symfony still processes the other_app which obviously isn't going to work properly. Symfony仍然会处理other_app,这显然不能正常工作。 Any suggestions.Do I need to modify htaccess in other_app/.htaccess as well?
有什么建议吗?我还需要在other_app / .htaccess中修改htaccess吗?
Also, let me add. 另外,让我补充。 When I access just the directory mysite.com/other_app I get the correct content.
当我仅访问目录mysite.com/other_app时,我会得到正确的内容。 If I try and access anything below that, I get problems.
如果我尝试访问低于此值的内容,则会遇到问题。
This works: mysite.com/other_app 这有效: mysite.com/other_app
This does not: mysite.com/other_app/page1 这不是: mysite.com/other_app/page1
In the logs I get an error: Action "other_app/page1" does not exist . 在日志中,我得到一个错误: 操作“ other_app / page1”不存在 。 Or something similar.
或类似的东西。
Ok. 好。 I figured it out.
我想到了。 The .htaccess of the sub directory also needs to be modified.
子目录的.htaccess也需要修改。
In web/.htaccess use: 在web / .htaccess中使用:
RewriteCond %{REQUEST_FILENAME} !-d
In the sub directory, web/other_app/.htaccess use: 在子目录中,web / other_app / .htaccess使用:
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. 这将适用于wordpress以及您想在symfony网站上运行的大多数其他php应用程序,但不想处理试图将其入侵框架的情况。
尝试添加:
RewriteCond %{REQUEST_FILENAME} !-d
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.