The SuluRedirectBundle adds simple but powerful capabilities for managing redirects to Sulu’s administration interface and allows content managers to manage redirects without any knowledge of web servers.
The SuluRedirectBundle is compatible with Sulu starting from version 2.0. Have a look at the require
section in
the composer.json to find an
up-to-date list of the requirements of the bundle.
Execute the following composer commands to add the bundle to the dependencies of your project:
composer require sulu/redirect-bundle
Afterwards, visit the bundle documentation to find out how to set up and configure the SuluRedirectBundle to your specific needs.
One of the great features of this bundle is the ability to import redirects from a CSV file.
The most simplified file just contains two columns, source
and target
.
Of course, all the other options like statusCode
, sourceHost
, and enabled
can also be set in the import file.
It’s also possible to override existing redirects with an import; you just have to set the same value for source
.
Sometimes it’s necessary to prepare redirects which are not ready yet, especially if you have a large number of redirects. Of course there’s a solution for that — toggler in the toolbar to enable or disable redirects quickly. This allows you to import a large number of disabled redirects and then check them in the administration interface, before enabling them when needed.
The SuluRedirectBundle comes with three different statuses to be used for redirects:
- 301 Moved permanently
- 302 Moved temporarily
- 410 Gone
Those status codes are explained in detail here.
This bundle also adds the possibility to automatically create redirects with status 410 Gone
, if a page or a entity with a route has been removed. This is very useful, because now search engines know, that this page has been deleted.
Redirects created via this bundle will only be used if no other route matches the given URL. This ensures that accidentally created or imported redirects do not affect existing pages. If a redirect matches the URL of an existing page, the redirect will only be effective after the page was unpublished.
In combination with the SuluAutomationBundle, this behaviour makes it possible to precautionarily create a redirect for the URL of an existing page that will be unpublished at a specified time in the future by the SuluAutomationBundle.
The Sulu content management system is a community-driven open source project backed by various partner companies. We are committed to a fully transparent development process and highly appreciate any contributions.
In case you have questions, we are happy to welcome you in our official Slack channel. If you found a bug or miss a specific feature, feel free to file a new issue with a respective title and description on the the sulu/SuluRedirectBundle repository.
The Sulu content management system is released under the terms of the MIT License.