How to access public folder in zf2 by htaccess subdomain [duplicate]

假装没事ソ 提交于 2019-12-13 06:23:21

问题


I am new in zf2. Please help me. I setup my new zend project on www.example.com/zend/ directory but it didn't call directly. Its call via www.example.com/zend/public

How can i access directly access by www.example.com/zend/ this url. I don't want to any changes in virtual host. I want only use of .htaccess file.

Kindly suggest me solution.


回答1:


Setup an htaccess file in your /zend/ directory:

RewriteEngine On
RewriteBase /zend/
RewriteRule ^(?!public/)(.*)$ public/$1 [L]



回答2:


This is not possible in Apache web server. You can define virtual hosts only in .conf files, but not in .htaccess files.



来源:https://stackoverflow.com/questions/21452554/how-to-access-public-folder-in-zf2-by-htaccess-subdomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!