Domanda

I have a Zend Framework application I've been working on my local machine, I've deploying it to a server but having .htaccess issues because some but not all routes fail with a "Page Not Found". Very weird that I can't access some controllers.

My .htaccess is:

RewriteBase /~user/path/to/app/public/

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

This error does not occur on the local machine, only on the server. The only thing I can see that is common to the controllers that have a "Page Not Found" error on the server is that the Controller names are camel case.

Controllers that work: CustomerController, InvoiceController, StockController. Controllers that fail: SuppliersStockController, StockTypesController.

If I try to do something like 'www.route/to/app/stock-types/' or '/stock.types/' I get an "Application Error".

È stato utile?

Soluzione

You are seeing the effect of a case sensitive file system.

When you go to /stocktypes/index, ZF will look for StocktypesController.php and succeed on case insensitive systems like Mac OS X and Windows. On Linux however, it will fail.

If you go to /stock-types/index, then ZF will look for StockTypesController.php and will find it on Linux.

If ZF finds a CamelCased controller name, then it will look for a view folder with a hyphen.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top