I'm programmer, I need a best practice to create a SEO friendly blog post URLs on PHP with specific pattern and logic.
Let say I have a table containing user_id, post_name, post_content, post_category, and post_date with this illustration table:
+----------+-----------+-----------------+---------------+---------------------+
| user_id  | post_name | post_content    | post_category | post_date           |
+----------+-----------+-----------------+---------------+---------------------+
| johnblog | my book   | lorem ipsum     | book          | 2014-09-02 11:44:25 |
| doeblog  | a coder   | dolor sit amet  | code          | 2014-08-29 11:17:16 |
| johnblog | something | consectetuer    | other         | 2014-07-25 12:18:46 |
| aldofoe  | true story| adipiscing elit | story         | 2014-07-20 12:23:20 |
+----------+-----------+-----------------+---------------+---------------------+
From this table, I want to make a structured user friendly URLs based on post_date, for example:
http://{user_id}.domain.com/{year}/{month}/{day}/{post_name}.html
eg: http://johnblog.domain.com/2014/09/02/lorem-ipsum.html
Logic rules:
1. If user go to http://johnblog.domain.com/2014/ show only johnblog's posts in that year.
2. if user go to http://johnblog.domain.com/2014/09/02/ show only johnblog's posts with specific post_date and so on.
What I need is a the best practice (like mapping user_id to the domain and sql queries) to play with this rules and I'll take the rest.
Thank you.
