在只能访问公共目录的主机上安装 Zend 项目
我在 Ubuntu 上开发了一个基于 Zend Framework 的项目。我在本地机器上创建了一个虚拟主机进行测试。它在我的本地机器上完美运行。这是本地计算机上的虚拟主机的条目。
<VirtualHost *:80>
ServerName example.dev
DocumentRoot /var/www/example/public/
<Directory /var/www/example/public/>
AllowOverride All
</Directory>
</VirtualHost>
问题:
我的问题是,当我购买域名(example.com)名称和托管时,他们给了我以下 ftp 目录来上传我的内容。
example.com
指向 /www.example.com/web/content
但我需要 example.com
指向 /www .example.com/web/content/public
我要求他们解决这个问题,但他们告诉我这是不可能的。有没有任何编程/配置解决方案。
谢谢
编辑:
我已经在 /www.example.com/web/content/public
中关注了 .htaccess
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I developed a project on Zend Framework on Ubuntu. I created a virtual host on my local machine for testing. It is working perfectly on my local machine. This is the entry for virtual host on local machine.
<VirtualHost *:80>
ServerName example.dev
DocumentRoot /var/www/example/public/
<Directory /var/www/example/public/>
AllowOverride All
</Directory>
</VirtualHost>
Problem:
My problem is that when I purchased domain(example.com) name and hosting they gave me following ftp directory to upload my content.
example.com
is pointing to /www.example.com/web/content
But I need example.com
to point/www.example.com/web/content/public
I asked them to solve it but they told it is impossible. Is there any programing/configuration solution of this.
Thanks
Edit:
I have already following .htaccess in /www.example.com/web/content/public
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据他们使用的 Web 服务器和他们拥有的配置,您也许能够覆盖某些配置,例如,您可以使用 apache 重写规则和
.htaccess
文件更改文档根目录,如下所示放在/www.example.com/web/content
的根目录下Depending on the web server they use and the configuration they have you may be able to override some of the configuration, for example, you can change document root with apache rewrite rules with a
.htaccess
file like this one to put under the root of/www.example.com/web/content
将index.php文件放入public文件夹中
并将 .htaccess 放在根文件夹中,巫婆内容
put index.php file into the public folder
and put .htaccess in the root folder, witch contents
这很简单,只需将公共目录内容移至父目录,以便 /www.example.com/web/content/public 中的所有文件
成为
/www.example.com/web/content
并且不要忘记编辑 index.php 文件中的包含路径以使用新位置
it is straightforward , just move public directory contents to the parent so all files in /www.example.com/web/content/public
become on
/www.example.com/web/content
and don't forget to edit include path inside index.php file to work with the new location