简体   繁体   中英

Zend framework 2 multiple module url routing issue

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

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 .

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

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