[MAGNOLIA-5886] New possible optional filter: Redirect Url's extension filter (SEO optimization) Created: 17/Aug/14  Updated: 09/Feb/22

Status: Accepted
Project: Magnolia
Component/s: core
Affects Version/s: 5.3.1
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christian Ringele Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File RedirectUriExtensionFilter-maxConfig.jpg     Text File RedirectUrlExtensionFilter.java     XML File config.server.filters.redirectUrlExtension-minimalConfig.xml     XML File config.server.filters.redirectUrlExtension.xml    
Issue Links:
Relates
causality
duplicate
duplicates MAGNOLIA-1564 Accessing a page without proper exten... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Magnolia serves the same page with the same URL and various different extensions:

  • URL(without extension) + html
  • URL(without extension) + htm
  • URL(without extension) + any unknown extension
  • URL(without extension) + no extension at all
  • URL(without extension) + / at the end

This is under certain circumstances not optimal for SEO, as it can result in duplicate content ranking penalties.

Customer pointing out the problem asked preferably a permanent redirecting solution, where all variations permanent redirect to one version.

I solved this creating a filter class.
It could be placed as optional filter into the product.

It is very comparable to the VirtualURI filter class, using the dispatcher tool to dispatch the request if needed.

Generally:
The filter permanently redirects any incoming URL matching a configured extension to the same URL 1:1 with the target extension. For examples:
http://demopublic.magnolia-cms.com/demo-project to http://demopublic.magnolia-cms.com/demo-project.html
http://demopublic.magnolia-cms.com/demo-project.dingsda -> http://demopublic.magnolia-cms.com/demo-project.html

What you can configure -> hat it does:

  • enabled -> self explaining
  • defaultExtension -> the default extension defining the target extension for all changes
  • useServerDefaultExtension -> instead of the "defaultExtension" using the configured server defaultExtension defined in config:/server@defaultExtension
  • redirectType -> type of rediect. Default 'permanent', second possibility 'redirect'
  • proibitedLeadPatterns (collection) -> any lead pattern of the url that should be ignored
  • redirectExtensions (collection) -> explicit extensions that should be changed to the 'defaultExtension'
  • redirectWithoutExtension -> redirecting when no extension exists or is '/' of '.'
  • redirectUnknownExtension -> redirecting any extension that does not map a MIME type defined in config:/server/MIMEMapping

Target place in filter chain:

  • Before cache

Additional work required:

  • test cases
  • javadoc
  • probably some refactoring & renaming


 Comments   
Comment by Christian Ringele [ 04/Sep/14 ]

Update filter class, also covering only requested server&contextPath and also domain mapped sites.

Generated at Mon Feb 12 04:09:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.