3

I am working on a Joomla 3.2.1 site and the client, without thinking, entered in the same alias for all articles, instead of letting the system use the article title. So now if I want to turn on SEF URL's we are going to have 404 issues in the future.

I want to resave or regenerate all article aliases at once (batch).

Is there a way to do it? in the MYSQL DB maybe?

Thank you in advance.

  • You entered them using a direct import or something? Because Joomla won't let you create the same aliases for multiple articles in the same category. – Elin May 03 '14 at 12:02

3 Answers3

1

$alias = JApplication::stringURLSafe($article->title);

emmanuel
  • 9,607
  • 10
  • 25
  • 38
Andrea
  • 137
  • 2
  • 11
0

Joomla will generate the alias when saving the article. I am not aware of any batch joomla feature to regenerate all the aliases and I would also be interested to know about this.

If no other batch solution exists, you should do manually the updates to these fields.

In the database, you could run update queries for all your articles, but you must type each update query one by one.

The update query for a single row would look like:

UPDATE jos_content
SET alias='my-new-alias-name'
WHERE id='{id-of-the-article}'

For multiple rows at once, you could do something like this:

UPDATE jos_content
SET alias = CASE id
    WHEN 1 THEN 'alias1'
    WHEN 2 THEN 'alias2'
    WHEN 3 THEN 'alias3'
END
WHERE id IN (1,2,3)
Sbpro
  • 948
  • 14
  • 27
0

What you could do is delete the alias data from all of your articles in the database using mysql. Then make a tag, like "fixalias." Using the batch processing feature tag all of the articles with that tag. This will run store() for all of your articles and automatically generate the aliases. Then delete the tag from the tag manager.you ar

A similar strategy would involve also deleting all the aliases but batch moving (don't copy) your articles to a temporary category and then moving them back.

Elin
  • 6,507
  • 3
  • 25
  • 47