How to access public folder in zf2 by htaccess sub

2019-09-01 14:15发布

This question already has an answer here:

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.

2条回答
聊天终结者
2楼-- · 2019-09-01 14:58

Setup an htaccess file in your /zend/ directory:

RewriteEngine On
RewriteBase /zend/
RewriteRule ^(?!public/)(.*)$ public/$1 [L]
查看更多
祖国的老花朵
3楼-- · 2019-09-01 15:12

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

查看更多
登录 后发表回答