terminal42 / contao-url-rewrite

Provides a back end module in Contao that allows you to specify url rewrites that are added to the Symfony Route collection
MIT License
15 stars 4 forks source link

not functional in Contao 5.0 (yet?) #37

Closed tonsinn closed 1 year ago

tonsinn commented 1 year ago

simple rewrite not working in a fresh Contao 5 installation: test123 [test123.html → {{link_url::99}}, 301 (Priorität: 0)]

in var/logs I find: [2022-12-17T10:32:20.356305+01:00] request.INFO: Matched route "url_rewrite_0". {"route":"url_rewrite_0","route_parameters":{"_route":"url_rewrite_0","_controller":"terminal42_url_rewrite.rewrite_controller:indexAction","_url_rewrite":"Terminal42\UrlRewriteBundle\ConfigProvider\DatabaseConfigProvider:1"},"request_uri":"https://www..../test123.html","method":"GET"} [] [2022-12-17T10:32:20.363238+01:00] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The controller for URI "/test123.html" is not callable: Controller "terminal42_url_rewrite.rewrite_controller:indexAction" does neither exist as service nor as class." at /www/htdocs/.../vendor/symfony/http-kernel/Controller/ControllerResolver.php line 79 {"exception":"[object] (InvalidArgumentException(code: 0): The controller for URI \"/test123.html\" is not callable: Controller \"terminal42_url_rewrite.rewrite_controller:indexAction\" does neither exist as service nor as class. at /www/htdocs/.../vendor/symfony/http-kernel/Controller/ControllerResolver.php:79)\n[previous exception] [object] (InvalidArgumentException(code: 0): Controller \"terminal42_url_rewrite.rewrite_controller:indexAction\" does neither exist as service nor as class. at /www/htdocs/.../vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php:57)\n[previous exception] [object] (Error(code: 0): Class \"terminal42_url_rewrite.rewrite_controller:indexAction\" not found at /www/htdocs/.../vendor/symfony/http-kernel/Controller/ControllerResolver.php:134)"} []

qzminski commented 1 year ago

Can you post the screenshot of your rewrite record configuration, please?

fritzmg commented 1 year ago

Isn't the route configuration missing? The routing.yml says it is defined via annotations:

https://github.com/terminal42/contao-url-rewrite/blob/839c6926769b0bd3da665176c712cf3044f2e787/src/Resources/config/routing.yml#L1-L3

However, there are no annotations for the RewriteController.

tonsinn commented 1 year ago
image
qzminski commented 1 year ago

@fritzmg it's not, the routes are added via UrlRewriteLoader, where we set the _controller attribute.

@tonsinn I am unable to reproduce your problem, unfortunately. Would you be able to set up a dev system on a remote server and send me the Contao + SFTP access details at kamil.kuzminski@terminal42.ch?

qzminski commented 1 year ago

@tonsinn thank you for the access details, I was able to track down the problem. I have created the pull request #38 and once it's merged, the problem should be gone. I have also hot patched your system, so it's already working there 😉

tonsinn commented 1 year ago

@qzminski thank you. Great job!