如何在 URL 中没有“public"的情况下访问 ZF2 应用程序 [英] How to access an ZF2 application without “public” in URL

查看:24
本文介绍了如何在 URL 中没有“public"的情况下访问 ZF2 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ZF2 上完成了我的项目,然后将其上传到共享主机上.我想要一个包含所有文件的 zend 应用程序文件夹,然后在文档根目录中,我希望 public 文件夹中的文件可见,因为我希望我的 URI 看起来像 <代码>www.example.com(不是www.example.com/public/).

I completed my project on ZF2, then uploaded it on shared hosting. I would like a folder for the zend app with all the files inside, and then in the document root I would like the files from the public folder to be visible, because I want my URIs to look like www.example.com (not www.example.com/public/).

推荐答案

我在 ZF1 应用程序的这些情况下所做的是在文档根目录中抛出一个应用程序目录,并使用您服务器的 .htaccess 等效文件使其不提供来自那里(拒绝所有人).然后将您的网关脚本粘贴到文档根目录中并更新在其中找到的路径,包括 APPLICATION_ROOT 和自动加载器的路径.

What I have done in those cases with ZF1 app is to throw an app directory in the document root and with your server's .htaccess equivalent made it not serve files from there (Deny from all). Then stick your gateway script into the document root and update the paths found in there including APPLICATION_ROOT and the path to the autoloader.

希望这会有所帮助.

这篇关于如何在 URL 中没有“public"的情况下访问 ZF2 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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