I am building a new site for my project, and I will be filling it will all the content from the current site. I simply need the new URL’s to fit my current site’s URL’s, so I won’t have to redirect everything.
I’ve come a little further now. The URL looks right now, but it needs to happen automatically, so it creates the URL’s dynamically, when you write a new post. How can I do this?
There is also a section of the website, that needs a word in the URL, som it looks like this: www.domain.com/artists/this-is-an-artist . It’s the same URL-construction, just with the word added. Can it be done?
Have a database table called artist, in it have a field for artist name and one for slug, call it slug/nice_url/seo_url/etc.
When you add a artist, say Artist Name, generate the slug/nice_url/seo_url based on the artist name and save it in your table, so you’d have artist_name = Artist name, slug=artist-name
Next, create a ArtistController, with a index action like:
public function actionIndex($slug)
{
$model=Artist::model()->findByAttributes(array('slug'=>$slug));
[...]
}