1

I am creating a question and answer site using PHP. Questions are viewed on one page using 'question.php?qid=1234', is the the correct thing to do, if so how to I make pages have URLs that search engines like StackOverflow (e.g. 'http://mysite.com/question/1234'). I am using Apache and MySQL. I have add a look around but I still don't quite understand what to do. Thanks in advance :)

(Sorry if this has already been asked)

3
  • you can use .htaccess. Otherwise, learn PHP frameworks for this. Commented Jan 20, 2012 at 6:25
  • By the way, why was this voted down? Commented Jan 20, 2012 at 6:46
  • Some folks thinks this is not a worthy question. Regarding of the difficulty it is to you, it may be just plain easy on them, considering it as a not-to-asked question. Don't feel down with just a downvote :) Commented Jan 20, 2012 at 8:07

1 Answer 1

3

In you .htaccess file, wtite this:

RewriteEngine On

RewriteRule ^question/([a-zA-Z0-9_-]+)$ question.php?qid=$1
Sign up to request clarification or add additional context in comments.

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.