I have a news section where pages resolve for URL
newsArticle.php? Id = 210
What would I like to do, use title from the database to create SEO-friendly titles
News Articles / From-the-Town
< P> Any ideas how can I get it?Thanks,
R.
I suggest that you actually include the ID in the URL, before the title part, and At the time of routing, Ignore the title. Your URL might be
/ news / 210 / joe-go-to-town
it's okay what the stack overflow does, and it works well. This means that the title can break without any links.
Obviously, the exact statement will depend on the platform you are using - you have not specified - but the basic steps will be:
- When generating a link, Take the title of the article and make it URL friendly; You probably want to remove all punctuation marks, and you should consider the worthy characters etc. Keep in mind that the title does not have to be unique because you get an ID
- For any item that starts with a request / news, take the next part of the path, it's a form of integer Paste in and load the appropriate article.
Comments
Post a Comment