58660

url not found in zend framework though working for index page

Question:

i am trying to develop website using zend framework so i had created one index.php file where all my requests goes and c.reated two controller one is IndexController and other is TestController

Class IndexController extends Zend_Controller_Action{ public function indexAction(){ echo "Index Index Jamla"; } public function displayAction(){ echo "Index Display Jamla"; } }

now when i access the url <a href="http://test/" rel="nofollow">http://test/</a> it correctly calls IndexController and its IndexAction function but when i access the url <a href="http://test/index/index" rel="nofollow">http://test/index/index</a> it displays the message url /index/index was not found on this server same it does when i access <a href="http://test/test/index" rel="nofollow">http://test/test/index</a>

though <a href="http://test/" rel="nofollow">http://test/</a> is equivalent to <a href="http://test/index/index" rel="nofollow">http://test/index/index</a>

Answer1:

The rewrite rules for Zend Framework are not working.

http://test works because Apache is defaulting to run index.php which will run your application. The router will see no URL parameters so it routes to index controller index action. When you attempt to access anything else, Apache is handling the request and is not rewriting it to index.php so you are getting a 404 not found.

Make sure the .htaccess containing the rewrite rules is in your public folder. Also check that Apache allows processing of .htaccess files for your document root by setting AllowOverride All in httpd.conf and/or httpd-vhosts.conf.

Answer2:

Make sure that you have set AllowOverride to All in your Apache configuration and have enabled the mod_rewrite extension

Answer3:

Silly but can you recheck again either index.phtml file exists under views/scripts/index/

Recommend

  • ZF2 TableGateway join
  • Symfony 2 - Layout embed “no entity/class form” validation isn't working
  • call controller and action method and pass model values
  • How to get the current module/controller/action from a view script in Zend Framework 2?
  • How to load select option from database in zf2
  • I dont understand why my variable is NULL
  • Redirecting to 404 route in PhalconPHP results in Blank Page
  • Symfony2 custom form field
  • Catch-all route in Symfony 3
  • Twitter bootstrap 2 - custom button styling not working
  • Multicolored edittext hint
  • Redux Form - Not able to type anything in input
  • How can I sort a a table with VBA with given text condition?
  • Set the selected item in dropdownlist in MVC3
  • D3 nodes and links from JSON with nested arrays of children
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Is calc() supported in html email?
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Submit form in a displaytag pagination
  • Does CUDA 5 support STL or THRUST inside the device code?
  • JSON with duplicate key names losing information when parsed
  • ActionScript 2 vs ActionScript 3 performance
  • To display the title for the current loaction in map in iphone
  • Jquery - Jquery Wysiwyg return html as a string
  • Circular dependency while pushing http interceptor
  • Traverse Array and Display in markup
  • bootstrap to use multiple ng-app
  • PHP: When would you need the self:: keyword?
  • How to get icons for entities from eclipse?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • AngularJs get employee from factory
  • Benchmarking RAM performance - UWP and C#
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • How to get Windows thread pool to call class member function?
  • JaxB to read class hierarchy