1

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/).

doydoy44
  • 5,720
  • 4
  • 29
  • 45

3 Answers3

2

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.

Hope this helps.

Orangepill
  • 24,500
  • 3
  • 42
  • 63
0

You can move the files inside /public to your webroot. However, please be aware that config files below your webroot are a security risk.

ACNB
  • 816
  • 9
  • 18
0

This one work.

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]
Mostafa Shahverdy
  • 2,687
  • 2
  • 30
  • 51
  • I don't believe `%{REQUEST_URI}` will ever be equal to an empty string. It will, at least, contain a `/` afaik. I suppose that rule is not needed anyway, as the 3rd rule + DirectoryIndex or the 3rd and 5th rule will rewrite it to the same, but I can't test that theory here. – Sumurai8 Oct 06 '13 at 06:17