Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 404 logging + Regexp matching for redirection rules possibility. #28

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

eprochasson
Copy link

Hello,

I added a few feature I was looking for.

  • All 404 that can not be matched with a redirect rules are logged and presented to the user. That's highly valuable when revamping a website, to make sure no URLs are lost in the process (and easily track the missing one and take action).
  • 404 logged can easily be transformed to a Rewrite rule
  • Added Regexp matching and replacing. It uses basic php function, seems to work quite well.
  • Added caching of previously encountered rewrite rules (to avoid hitting the database to often when a rewrite is common)

Since it adds a few new columns to the modRedirect table, so it might not works perfectly as an update to previous versions. I'm sure there is a way to handle that properly though. I was also unable to update the Schema for sqlsrv. Finally, as I don't speak so many languages, I only updated the English and French lexicons.

I took the liberty to add my name to the list of contributors :) and pop the version number since I believe this is quite a major change.
I also understand that, as it's quite a major change, it might not really respect the original idea behind Redirector. If it's uncool, I'll just fork it but I'd be much happier to integrate that directly in Redirector.

@eprochasson
Copy link
Author

Ha, I just commited a small security fix, to strip [ and ] from the URL (to avoid MODx code injection, since the replacement URL is parsed).

@jpdevries
Copy link

working on merging some PRs into the new repo over at modxcms/Redirector. Am going to need to come back to this one

@bertoost
Copy link

Working on this.. PR on modxcms soon!

[update]
Really rocks! Example:

Pattern: ^shop/category-(.*)/$
Target: webshop/$1/
Test: shop/category-shoes/
Results: webshop/shoes/

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

Successfully merging this pull request may close these issues.

3 participants