How to create dynamic page for blog post

Hi guys,

I’m building a simple blog. So basically I have a homepage with some thumbnails of recent/featured blog posts. When you click a thumbnail, you should go to a page displaying the real content of the blog post. However, I’m not sure what’s the best way to create this page.

Is it okay to work with a querystring and the blog post ID and then just let PHP generate all the content from the database, like this:

www.myblog.com/blogpost?id=0001

This looks like a no-go having SEO in mind. Does it make any difference if I would use this:

www.myblog.com/blogpost?title=my-first-blog

Also, I don’t see a lot of blogs using querystring to display blog posts. Take Sitepoint for example, when you click a blog post you get a link like this:

www.sitepoint.com/3-javascript-orms-you-might-not-know/

How does this work, this is still a dynamic generated page, right? Is this some .htaccess rewrite trick? Or do people really generate full html-pages and store them on the server when they create a blog post?

So what’s the best approach to create this page for blog posts.

Many thanks!

I’ve dont it with .htaccess URL rewriting thanks to this nice tutorial: http://www.smashingmagazine.com/2011/11/introduction-to-url-rewriting/ :smile:

So now when a user clicks a thumbnail, I link them to www.mydomain.com/blog/001/my-first-post. That’s the link they’ll see in the address bar, but actually the content of the page www.mydomain.com/blogpost.php?id=001 will be loaded. Neat!

This is my .htaccess code

RewriteEngine On
RewriteRule ^blog/(.+)/(.+)$ blogpost.php?id=$1 [L]

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.