的Symfony忽略目录网页/ [英] Symfony Ignore Directory in web/

查看:84
本文介绍了的Symfony忽略目录网页/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个symfony项目,有没有办法从正在处理中排除目录。

例如,我想在mysite.com/other_app运行一个单独的PHP程序

我如何排除网络/ other_app文件夹从symfony的控制器进行处理。

我已经试过用

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

的RewriteCond%{} REQUEST_FILENAME!-d

Symfony的还是处理other_app这显然是不会正常工作。任何suggestions.Do我需要修改htaccess的在other_app / htaccess的呢?

此外,让我补充。当我刚进入该目录mysite.com/other_app我得到正确的内​​容。如果我试着访问下面的东西,我得到的问题。

这工作: mysite.com/other_app <​​/ P>

这不: mysite.com/other_app/page1

在日志中我得到一个错误: 行动other_app /第1页不存在。或者类似的东西。

解决方案

确定。我想到了。子目录的htaccess的也需要进行修改。

在网络/ htaccess的使用:

 的RewriteCond%{} REQUEST_FILENAME!-d
 

在子目录,网络/ other_app / htaccess的使用:

  RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$ /other_app/index.php [QSA,L]
 

这将适用于字preSS和大部分要在symfony的网站上运行,但是任何其他的PHP应用程序不想要对付试图破解它变成了框架。

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.

这篇关于的Symfony忽略目录网页/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆