1
votes

Am facing the issue when I have two or three module in my framework like

  • Album
  • Admin
  • User

The way I can access the above module using URL is as follows

But I want access the module in the following way

I have checked on the following links but this dose not worked for me

Having trouble with URI routing for modules in Zend Framework
Routing in Zend Framework 2
Zend framework 2 module name routing issue
Zend Framework 2 - Multiple modules by URL
Zend Framework 2 routing issue
404 error, Zend Framework 2 The requested URL could not be matched by routing

For removing the public I have managed by creating the Index.php at the root level of the project with the following code

<?php 
    define('RUNNING_FROM_ROOT', true);
    include 'public/index.php';

Please help me if anyone has faced similar issue

2
Looks more like an apache or nginx routing thing rather than php...? If you run Apache, check if your rewrite engine is on and the rewrite rules are in. - Raphioly-San
@Raphioly-San: I have checked rewrite engine and rewrite rule as well, both are in place. Do you want me to check anything more? - Sarang
Check if the rewrite module is activated? Depending on how you configured it, you may have to check if your .htaccess may override settings in your virtualhost configuration. If not, add AllowOverride All to your <Directory > nodes (or alter if exists). And if you're running on Windows? Windows has a weird feature you may need to set... - Raphioly-San
You should serve the application from your public folder. It seems like you serve from the ZF2 application root folder. Change your server settings to serve from /public instead. Otherwise check the answer to an alternative solution here - Wilt

2 Answers

1
votes

You should not add your own index.php at root level. You should delete this file again. Your issue is that you should serve the application from your /public folder folder.

It seems like you are currently serving from the ZF2 application root folder. The recommended solution is to change your server settings to serve from /public instead. In Apache you can do this for example using your virual host config. It has a DocumentRoot param.

Otherwise check the answer to an alternative solution here.

0
votes

Solved the Issue

  • Removed both the index.php and .htaccess file from the root level
  • set the virtual host from the zend document
  • Followed the answer given on stackoverflow

Configuration am using

  • Ubuntu 14.04
  • PHP 5.5.9
  • apache2