久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

虛擬主機上的 Symfony(文檔根問題)

Symfony on virtual host (document root problem)(虛擬主機上的 Symfony(文檔根問題))
本文介紹了虛擬主機上的 Symfony(文檔根問題)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在 Symfony 和本地主機 (XAMPP) 上開發應用程序,我想模擬與網絡服務器上相同的條件.

I'm developing an application in Symfony and on localhost (XAMPP) I want to simulate the same conditions as on the webserver.

Web 服務器配置如下:

The web server is configured as follows:

/www   => mydomain.com
/foo   => foo.mydomain.com
/bar   => bar.mydomain.com
...

我將把我的 Symfony 應用程序放到 /www 目錄中,這樣就會有:

I'm going to put my Symfony application into /www direcotry so there'll be:

/www
/www/apps
/www/apps/frontend
/www/apps/frontend/...
/www/apps/backend
/www/apps/backend/...
/www/cache
/www/config
... and so on...
/www/web

問題是文檔根目錄仍然設置為 /www 目錄,但 Symfony 期望它在 /www/web 中.
當然,如果我調用 http://mydomain.com/web 它會起作用,但我想你明白這是一個安靜的愚蠢解決方案.

The thing is that the document root is still set to the /www directory but Symfony expects it in the /www/web.
Of course it will work if I call http://mydomain.com/web but I guess you understand this is quiet stupid solution.

所以我的問題是:有什么方法可以使用 .htaccess 或其他方法更改/繞過默認文檔根設置?

So my question is: Is there any way how can I change/bypass the default document root setting using .htaccess or whatever?

我解決了.

推薦答案

我對 Symfony 了解不多,但 /web 應該是文檔根目錄.出于安全原因,所有其他目錄都應位于文檔根目錄之外,并避免 URL 中的 /web 部分用于另一個.但看起來你已經知道了.

I don't know much about Symfony but /web is supposed to be the document root. All the other directories should be outside the document root for security reasons for one, and to avoid the /web part in the URL for another. But it looks like you already know that.

如果您可以編輯 Web 服務器的配置,請嘗試反映并將 DocumentRoot 設置為 Web 目錄.

If you can edit the web server's configuration, try to reflect that and set DocumentRoot to the web directory.

如果您不能這樣做:無法更改 .htaccess 文件中的 DocumentRoot,但可以重寫所有請求,以便它們轉到 /web 在內部使用 mod_rewrite.它很笨拙,但如果您不能影響 DocumentRoot,這可能是最好的解決方案.

If you can't do that: It's not possible to change the DocumentRoot in a .htaccess file but it is possible to rewrite all requests so they go to /web internally using mod_rewrite. It's kludgy, but probably the best solution if you can't influence DocumentRoot.

我不是一個 mod_rewrite 大師,所以我不能提供一個例子(我必須先測試它,我現在不能這樣做)但我相信有人會.也許將 mod_rewrite 標簽添加到您的問題中.

I'm not a mod_rewrite guru so I can't provide an example (I would have to test it first and I can't do that right now) but I'm sure somebody will. Maybe add the mod_rewrite tag to your question.

更新:未經測試但應該工作.放入 /www 中的 .htaccess 文件:

Update: Untested but should work. Put into a .htaccess file in /www:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/web/ 
RewriteRule .* /web/%1 [QSA]

然后您需要更改配置文件以使用 http://www.domain.com/ 而不是 http://www.domain.com/web/當然.

you would then need to change your configuration files to use http://www.domain.com/ instead of http://www.domain.com/web/ of course.

我不能說這是否會干擾 Symfony 端的任何其他 .htaccess 規則 - 您必須嘗試一下.

I can't say whether that interferes with any other .htaccess rules on the Symfony end - you'd have to try out.

這篇關于虛擬主機上的 Symfony(文檔根問題)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發技術
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 成年精品 | 久久999 | 精品区| 日本一区二区三区四区 | 国产精品色 | 在线成人免费av | 在线观看国产视频 | 91精品导航| 丁香婷婷成人 | 午夜免费网站 | 一级毛片网| 日韩精品久久久久 | 精品久久久久久红码专区 | 国产精品视频一区二区三区不卡 | 国产毛片视频 | 精品1区2区| 久久久噜噜噜久久中文字幕色伊伊 | 一区二区三区欧美 | 伊人久久在线 | 剑来高清在线观看 | 亚洲一区二区三区免费在线观看 | 日本特黄a级高清免费大片 成年人黄色小视频 | 在线国产一区 | 日本手机看片 | 91最新在线视频 | 国产免费一区二区 | 超碰成人在线观看 | 日韩精品一区二区三区中文字幕 | 精品在线免费看 | 精品不卡 | 97精品国产97久久久久久免费 | 久久精品欧美一区二区三区麻豆 | 国产亚洲黄色片 | 久久成人精品一区二区三区 | 一区二区三区免费 | 一区二区国产精品 | 欧美国产精品一区二区三区 | 精品免费国产一区二区三区四区 | 日本免费一区二区三区视频 | 91欧美 | 亚洲精品视频在线观看视频 |