views:

142

answers:

1

I recently started learning zend framework. I am trying to access the index.php inside the public folder, but when i test the project using WAMP server in browser, I can't find the public folder in the web root. I can see other folders like applications, library, docs but there isn't any public folder.

Why can't I view the public folder of Zend Framework Project?

UPDATE my .htacess file inside the /public folder

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
+1  A: 

UPDATED You need to enable Apache's mod_rewrite. To do this

  • Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)

  • Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line)

  • Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

For Further information, go to the source http://www.astahost.com/info.php/Apache-Tutorial-Enable-Mod_rewrite-Windows_t11623.html

PREVIOUS If you set up your virtual host the default way, i.e.

<VirtualHost *:80>
   DocumentRoot "C:/Users/user/www/yourdomain.dev/public"
   ServerName .local

   # This should be omitted in the production environment
   SetEnv APPLICATION_ENV development

   <Directory "C:/Users/user/www/yourdomain.dev/public">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>

</VirtualHost>

You may access the public dir, by:

http://yourdomain.dev/

and files in public dir by:

http://yourdomain.dev/filename.ext

It is all about DocumentRoot.

takeshin
Don't forget the hosts file entry to allow for http://yourdomain.dev.
Inkspeak
however, if I remove .htaccess file it is showing up. So there is something about .htaccess file
Starx
@Starx Is mod_rewrite enabled? To enable it: `a2enmod rewrite` and restart Apache.
takeshin
Take a look at Apache's error.log, it may give you more info on what's going on. Also: 1) Is Apache mod_rewrite installed? 2) Note that if you set up the application in a subdomain, e.g. `http://localhost/myapp` rather than in the root of the domain, you'll need to add `RewriteBase /myapp/` in your .htaccess file.
nuqqsa
@nuqqsa, apache error log is giving this error, E:/wamp/www/ZendPractice/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Starx
@takesin, where to enable `a2enmod rewrite`
Starx
@Starx This is command for Ubuntu, Google for other operating systems. Look for mod_rewrite in output of the `phpinfo()` function.
takeshin
No there isn't any mod_rewrite in the display of phpinfo() and is apache's php.ini. Can you actually see the .htaccess output I provided and see what is hiding the folder
Starx
@Starx What's your OS? You just have to enable mod_rewrite, and it will be fine.
takeshin
@takeshin: Thanks a lot, I found a way to enable mod_rewrite. I will update your answer and provide the link
Starx