0

We're now close of relaunching one of our websites with sulu - this brings up the question how to deal with the old URLs. Is there a way in sulu admins to define other urls of a page, that will then be redirected via 301 to the new sulu path?

If not, is there a way to extend the admin and kind of hook into the router maybe?

I could imagine it easily as a new tab or under the SEO tab, something like "legacy urls (will be redirected via 301 to this path)":

enter image description here

Thx a lot for your support!

Andreas
  • 1,691
  • 1
  • 15
  • 34

1 Answers1

1

There are 2 Solution for redirects

Using Custom Url

There is a way to add custom urls for a specific page using the sulu Custom Url feature. It supports that a custom url does redirect to a specific page in a specific language.

Custom Url need to configure in the webspace urls part:

<custom-urls>
    <custom-url>sulu.lo/*</custom-url>
    <custom-url>*.sulu.lo</custom-url>
    <custom-url>*.sulu.lo/*</custom-url>
</custom-urls>

Sulu Redirect Bundle

There is a bundle in the core sulu namespace which can be used to configure redirects or import redirect from a csv. The SuluRedirectBundle which can be used to create redirects and also it allows to create 410 errors for removed pages.

The bundle can be installed the following way:

composer require sulu/redirect-bundle:"^2.0@dev"

At current no 2.0 version is released so @dev is needed.

Alexander Schranz
  • 2,154
  • 2
  • 25
  • 42
  • Hi @AlexanderSchranz, if I understand the bundle doc correct, it handles redirects within Sulu, but allows not to create redirects for old legacy urls of a non-sulu predesessor website? – Andreas Jun 25 '19 at 03:00
  • 1
    @Andreas no if you install it give your user permissions for the redirect bundle you can add under Settings -> Redirects new redirects. You can also import whole csv files with redirects. – Alexander Schranz Jun 25 '19 at 08:00
  • Hi @AlexanderSchranz - it took me actually too long to implement this. Is there a way for sulu 2.x as well already? Under Webspaces > Custom Urls I can not create a new entry, because the base domain field is empty. Thx a lot! – Andreas Oct 09 '20 at 11:15
  • ok, for sulu 2.x I found this section now: https://docs.sulu.io/en/2.1/cookbook/custom-urls.html?highlight=redirect – Andreas Oct 09 '20 at 11:20
  • @Andreas Thanks did update the answer to mention also that. – Alexander Schranz Oct 13 '20 at 18:22