Hi,
I'd like to get some direction about how to generate alias URLs programmatically. I'll explain what I'm doing. I have a Joomla system plugin which changes the category of my K2 articles when the expiration date of the article is reached. K2 articles represent future events so when they expire they are moved to the past events category. So far so good.
When changing the category, obviously the article SEF URL changes since the category alias is part of the article SEF URL.
So this is what happens:
Before article expiration the SEF URL is: www.mysite.com/upcoming-events/my-event
Once expired the new SEF URL is: www.mysite.com/past-events/my-event
So I would like to add some code in my plugin so at the same time that I change the category of the article I include the old SEF URL (before expiration) as an alias of the new SEF URL (once the category change has happened).
I was looking to do an insert into the sh404sef_aliases table in the database and hope that this will create the 301 re-direct as per standard sh404sef alias behaviour. But I'm not sure that will work or whether is the best way of achieving what I'm aiming at.
I look forward to your suggestions, thanks!
I'd like to get some direction about how to generate alias URLs programmatically. I'll explain what I'm doing. I have a Joomla system plugin which changes the category of my K2 articles when the expiration date of the article is reached. K2 articles represent future events so when they expire they are moved to the past events category. So far so good.
When changing the category, obviously the article SEF URL changes since the category alias is part of the article SEF URL.
So this is what happens:
Before article expiration the SEF URL is: www.mysite.com/upcoming-events/my-event
Once expired the new SEF URL is: www.mysite.com/past-events/my-event
So I would like to add some code in my plugin so at the same time that I change the category of the article I include the old SEF URL (before expiration) as an alias of the new SEF URL (once the category change has happened).
I was looking to do an insert into the sh404sef_aliases table in the database and hope that this will create the 301 re-direct as per standard sh404sef alias behaviour. But I'm not sure that will work or whether is the best way of achieving what I'm aiming at.
I look forward to your suggestions, thanks!