The requested URL could not be matched by routing.

For programming and general questions on Zend Framework
Post Reply
Posts: 1
Joined: Fri Sep 06, 2013 7:41 am

The requested URL could not be matched by routing.

Post by vish808 » Fri Sep 06, 2013 7:53 am

Hi ,
I have set up zendframework 2 Skeleton Application in my local machine . Application is loading fine but when I access the URL as /index , it throws me the error as below
A 404 error occurred
Page not found.

The requested URL could not be matched by routing.
No Exception available

Im on Ububtu , Apache . Mod_rewrite is enabled .

Have not changed any code from .htaccess file
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

AND in sites-available

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName dev2 dot localhost dot com
SetEnv APPLICATION_ENV "development"
DocumentRoot /var/www/dev2/public
<Directory />
Options FollowSymLinks
AllowOverride All
<Directory /var/www/dev2/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128


Please suggest me , If I have made any error .

User avatar
Zend Global Services
Posts: 34
Joined: Sat Jun 30, 2012 9:59 pm
Location: United States

Re: The requested URL could not be matched by routing.

Post by clarkphp » Fri Sep 06, 2013 4:53 pm

Hello vish808,

If you look at module/Application/config/module.config.php, you'll see under the 'routes' key in the array that only the literal routes '/' and '/application' have been defined, with the additional child route of '/[:controller[/:action]]' defined underneath '/application'.

This means that only the following URLs will match the defined routes:

Note that the segment route 'route' => '/[:controller[/:action]]', means that /application/index/ and /application/index/index/ (with a trailing slash) will NOT match and will result in a 404.

See the page ... uting.html
and ... llers.html

Take your time, read it through carefully, and experiment a bit.
Best Regards,

Post Reply