1

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

Community
  • 1
  • 1
Sarang
  • 754
  • 3
  • 9
  • 24
  • 1
    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 Jan 11 '16 at 10:40
  • @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 Jan 11 '16 at 13:00
  • 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 `` nodes (or alter if exists). And if you're running on Windows? Windows has a weird feature you may need to set... – Raphioly-San Jan 11 '16 at 13:06
  • 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](http://stackoverflow.com/questions/21452554/how-to-access-public-folder-in-zf2-by-htaccess-subdomain) – Wilt Jan 11 '16 at 14:20

2 Answers2

1

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.

Community
  • 1
  • 1
Wilt
  • 41,477
  • 12
  • 152
  • 203
0

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
Community
  • 1
  • 1
Sarang
  • 754
  • 3
  • 9
  • 24