Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?

Is it possible to redirect ./index.php?facebook to ./facebook.php? If so, how to do this?

Many thanks in advance,

share|improve this question

marked as duplicate by Steven Monday, Ladadadada, Michael Hampton, Ward, Scott Pack Aug 25 '12 at 2:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Still can't get it. – Eamorr Jul 20 '12 at 17:32

There are at least two ways to do it.

  • With Apache's mod_rewrite:
    RewriteEngine On
    RewriteCond %{QUERY_STRING} =facebook [NC]
    RewriteRule (.*)/index.php$ $1/facebook.php [R,L]
  • Within the index.php PHP script itself (my PHP is very rusty; consider this to be pseudo-code):
    if (isset($_GET['facebook'])) {
        header('Location: facebook.php');
share|improve this answer
Hi, it just won't work (Apache2 method). I'm not getting any errors in Apache2 logs... – Eamorr Jul 20 '12 at 18:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.