0

In a site I'm developing I have a page that presents a post based on the variable in the url: http://www.mywebsite.com?id=18 So this would load the post who's ID is 18 in the mySQL database.

I would like the create the same effect, but with the url being something like: http://www.mywebsite.com/articles/title-of-article-18/

Would there be a way to create these pages on the fly with dynamic post content, where the url would originally be created by: "http://www.mywebsite.com/articles/" + postTitle

1
  • What is your underlying technology (platform/language, server, etc.)? Every environment has its own way of achieving this, so the answer is "yes", but you have to give more information to get specifics. Commented Oct 16, 2012 at 8:20

2 Answers 2

1

You are looking for mod_rewrite and rewriting of urls via htaccess.

What it does is it takes patterns from your url, and the htaccess file detects the pattern redirects that to http://www.mywebsite.com?id=18. Users still see the nice url.

The directory /articles/title-of-article-18/ will not actually exist, and the user never really reaches that location because the htaccess secretly changes the url that the server processes.

See http://en.wikipedia.org/wiki/Rewrite_engine

or a random tutorial I found: http://www.blogstorm.co.uk/htaccess-mod_rewrite-ultimate-guide/

Sign up to request clarification or add additional context in comments.

Comments

0

try url-rewriting

http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.