简体   繁体   中英

zend framework 2 project in server doesn't work

Working with zf2, we have configured the project successfully in local env, we deployed the same code to server, but there..only the IndexController action is working. like www.project.com/public/ works,

but when I access other modules like

www.project.com/public/country doesn't work. 

在此处输入图片说明

This means the mod_rewrite rules to rewrite all requests to your index.php file are not being used. Generally this means either:

  • The .htaccess file was not uploaded (check the public folder on the server to see if it's there)
  • The .htaccess file is being ignored (check AllowOverride for the vhost on the live server)

Also, really public/ should not appear in your URLs. Unless you are using shared hosting (where this can be tricky), you want to point your vhost's document root at the public folder.

In a proper Zend setup an error should come from Zend. When you get an error like this, returned from Apache, your apache configuration is not working. Your Zend application isn't even considered, ie the index.php in your public folder.

It's a save guess that your [public/].htaccess isn't used. Check your apache web configuration. Most likely you're missing the AllowOverride All statement which is usually inside the <Directory> statement.

And as mentioned by Tim you really should not have public/ in your path to begin with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM