nystudio107 / retour

DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Other
168 stars 24 forks source link

Unable to redirect URLs that have a URL pattern in the `routes.php` file #100

Closed angelinetran closed 6 years ago

angelinetran commented 6 years ago

Hello!

You're plugin is great! We love it, but we are having one issue:

Our routes.php file has a URL pattern like below:

return array(
  'find-providers/provider/[^\/]+' => 'find-providers/_entry',
);

And we have an entry like below: screen shot 2018-05-03 at 1 57 47 pm

If we try to go to http://example.com/find-providers/provider/nichole-hickman-np-6714, it will not redirect to http://example.com/find-providers/provider/nichole-e-hickman-np-6714

We believe that the routes.php file is trumping the redirects from this plugin.

Any help with this would be appreciated.

Thank you!

darinlarimore commented 6 years ago

Hey there, we ended up fixing this by forcing the template to 404 which allowed the redirects to work just as they should!

{% if data | length == ""  %}
  {% exit 404 %}
{% endif %}

We added this to the template.

benjamin-smith commented 1 year ago

For anyone stumbling on this after a long time, this was added in version 1.0.18

https://github.com/nystudio107/retour/blob/658cdea255a2b6726a77c887b7294ab75be244c2/releases.json#L59

khalwat commented 1 year ago

@benjamin-smith this is the old Craft 2 repo -- now deprecated

benjamin-smith commented 1 year ago

Boy don't I wish the site I was working on was on Craft 4 :) I spent a couple extra cycles debugging this until I saw the plugin was a couple versions back. Just leaving the note for posterity.