eZ Platform Discussions

System Urls (rename or redirect to an Alias)


#1

Hi All,
Is theere a way to change the System url for example:
current: /developer/members/whatever
new one: /developer/members/whateverever

  1. Is theere any way to change the System Urls?
  2. Can i create an Alias with a new url where the old system url are redirected to the new one?

what i tryied already:

  • i had try already to define a new alias (in cms) but the result are that both urls are available
  • when i changed the url in the database (the result is that the content cant be saved anymore)

Any idea?


#2

Hello @dajo82.

System URL aliases are generated from specific Content item field.
If you go to Admin -> Content Types and navigate to a Content Type, e.g. Content > Article, you’ll see labels like “Content name pattern” and “URL alias name pattern”. If “URL alias name pattern” is empty, “Content name pattern” is used. For instance Article has Content name pattern defined as <short_title|title> which means that if short_title for a Content item is not present, title will be used.

So for your case, if “whatever” corresponds to a title/name of a Content item, you can edit that Content item’s Content Type and setup either:

  • extra field to be used tor URL alias name pattern
  • if “ever” suffix in “whateverever” is constant, you could simply set URL alias name pattern as e.g. <short_title|title>ever. Of course used field name must correspond to your Content Type field name. The example assumes this is an Article.

Changes in Content type settings will be reflected on next publish operation of a Content item. If you want to apply them globally for all Content items at once, you could use Symfony command ezplatform:urls:regenerate-aliases.

Old URL alias will redirect to a new one.

Please let me know if you have any further questions or if something is not clear.

Kind regards,
Andrew.


#3

Hello Andrew,
Thanks for the answer.
I’ve tried it out, but I’ve noticed that this feature is available in version 2.2 (my version is 2.1).
Is something similar in the 2.1 version?

Kind regards,
Darius


#4

Hi @dajo82. Sorry for the long delay.

Version 2.1 is long out of commission (not maintained, after End of Life) as it was Fast Track Release. You should upgrade to the latest 2.4 as soon as possible.

Unfortunately the ezplatform:urls:regenerate-aliases command won’t be available for the 2.1 version. The other features described in my previous reply should work.

For older 2.x there’s old script available after enabling EzPublishMigrationBundle (by adding to the list of bundles in the AppKernel: new \eZ\Bundle\EzPublishMigrationBundle\EzPublishMigrationBundle(). It was the ezplatform:regenerate:legacy_storage_url_aliases command. It required manual database maintenance before proceeding and didn’t keep history of previous entries before update. For more details see ./bin/console ezplatform:regenerate:legacy_storage_url_aliases --help.

I would recommend upgrading :slight_smile:

Kind regards,
Andrew.