-
Improvement
-
Resolution: Unresolved
-
Neutral
-
None
-
5.3.1
-
-
Yes
-
Empty show more show less
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
- duplicates
-
MAGNOLIA-1564 Accessing a page without proper extension should return 404 error
- Closed
- is related to
-
MAGNOLIA-8378 Configurable way to end links with slash
- Open