PM-Riabel PM-Riabel - 1 year ago 114
PHP Question

How Symfony routing works

I am a beginner for Symfony and following the Symfony documentation and it has a create page tutorial
and after creating this this when I test this using the browser,

I can access it using the following URLs

localhost:8000/lucky/number and


but when I try to access it using the usual way like


it gives 404 and I use Ubuntu with Apache2 localhost so I need to know the idea behind this Symfony3 routing and why I cannot access the page using usual localhost/cmstest/lucky/number


Answer Source

Because you have to use the web/ directory (which is the public root of your application, only this directory should be accessible using the browser).

When using server:run, it'll use web/ as your server root automatically. When accessing via the directory structure, include it in the URL: http://localhost/appname/web/lucky/number

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download