contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

FR: allow custom routing via routing.yml #38

Closed m-vo closed 7 years ago

m-vo commented 7 years ago

Not sure where to put this as this might me rather a problem of the missing docs than a real issue.

If I understand correctly the idea of the RoutingPluginInterface is to be able to specify custom routes in your own bundles or the ContaoManagerPlugin in global namespace (analogous to what the BundlePluginInterface is to loading bundles in the right order). When simply implementing the interface in both cases, the getRouteCollection (...) method never gets called (the class gets loaded, however). Is this the right approach or what am I missing?

Btw.: In my case I am trying to setup legacy redirects from an old installation. For this case it would be handy if an app/config/routing.yml would be loaded if it exists like the config.yml / config_*.yml.

fritzmg commented 7 years ago

Without seeing your code it's hard to tell what you might have done wrong. See also https://community.contao.org/de/showthread.php?66697-AJAX-im-Frontend&p=440081&viewfull=1#post440081

m-vo commented 7 years ago

Thanks, my structure looked pretty similar to the one you posted. I just found out it only does not work via the app_dev.php enty point. Is there a reason for this?

m-vo commented 7 years ago

I then like to reframe this as a feature request: :-)

It would be nice if it would be possible to add a custom routing.yml to the app/config folder that gets loaded automatically. This would e.g. allow for some simple redirects:

legacy_redirect:
    path: /someLegacyPath
    defaults:
        _controller: FrameworkBundle:Redirect:urlRedirect
        path: /someNewPath
        permanent: true
fritzmg commented 7 years ago

Thanks, my structure looked pretty similar to the one you posted. I just found out it only does not work via the app_dev.php enty point. Is there a reason for this?

Have you tried to debug the routes with

./vendor/bin/contao-console debug:router -e=dev

?

m-vo commented 7 years ago

(Oh that's a nice tool, I didn't know that!)

The route is listed there right on top for both prod end dev environment. However, when accessing it via app_dev.php the contao_catch_all route gets selected.

So basically with a custom route of /some/custom/route:

fritzmg commented 7 years ago

Are you running nginx or Apache?

m-vo commented 7 years ago

Apache. Just testet it: it works on nginx. That's interesting.

fritzmg commented 7 years ago

Then it must be a server misconfiguration. Did you alter the default web/.htaccess?

Anyway, such issues should be resolved on the community forum, not here ;)

m-vo commented 7 years ago

Nope that's the original one..

leofeyer commented 7 years ago

Then it must be a server misconfiguration

Since it does work on Nginx, I agree with @fritzmg.