Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Create 404 re-direct plugin #346

Closed
johanjanssens opened this issue Feb 28, 2018 · 2 comments · Fixed by #347
Closed

Create 404 re-direct plugin #346

johanjanssens opened this issue Feb 28, 2018 · 2 comments · Fixed by #347
Assignees
Labels
Milestone

Comments

@johanjanssens
Copy link
Member

To handle redirects from URL's with an ID to url's without an ID, create a redirect plugin that intercepts the 404 error and then tries to calculate the URL without ID from the URL with id.

For an example how to intercept 404 errors see: https://github.com/joomla/joomla-cms/blob/staging/plugins/system/redirect/redirect.php#L107

For the handling of the URL, build a regex that strips the ID's from the URL and then redirect to the URL again. ID's to be stripped always follow the "/xxx-" format, where xxx is a number. If no /xxx- can be found in the url assume it's no id url and don't try to re-direct it, just handle the error as normal.

Nice to have's

  • Write the redirects to file in a format supported by nginx. Each time a new redirect is found add it to the file. Then we can load this file into nginx and have the server handle the redirects if he knows about them.
@johanjanssens johanjanssens added this to the 2.0.0-beta milestone Feb 28, 2018
allanpilarca added a commit that referenced this issue Mar 1, 2018
This plugin will check 404 error and redirect with-id to no-id url.
@johanjanssens
Copy link
Member Author

johanjanssens commented Mar 20, 2018

@allanpilarca We have included a 404 redirect plugin in TEXTman too. This plugin only includes support for com_content @ercanozkaya approached it slighly different. Can you review his code and see if it it includes any potential improvements you can make?

See: https://github.com/joomlatools/textman/pull/513

@allanpilarca
Copy link
Contributor

@johanjanssens will apply the improvements in this ticket #353

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants