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

I want to convert the below url:




I tried something as below, but it did not work:

RewriteRule ^(.*)$ /letters.php?q=$1&d=$2&t=$3 [R=301,L]
share|improve this question
Your title and question body ask for opposite things. Please adjust one of them. – John Gardeniers Dec 31 '12 at 9:39
Yes, I want to change the title. How can I do? – Fun Jan 2 '13 at 4:01
Figured to changed the title :) – Fun Jan 2 '13 at 4:06
up vote 1 down vote accepted

You would need to break up the RewriteRule extract each part of the uri i.e. test, 789 and 2; like this:

RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /letters.php?q=$1&d=$2&t=$3 [NC]

There is a good article on .htaccess tip and tricks that shows how rewrite rules work.

share|improve this answer
Thank you SubOracle!!! It works super!!!!! – Fun Dec 31 '12 at 9:13
@Fun if this answer solve your problem, do not forget to accept it. – j0k Dec 31 '12 at 9:44
If you're going to be doing redirects for more than one page (ex: letters.php, words.php, etc) consider putting in a constant unique part to the URL like ^letters/([^/]+)/([^/]+)/([^/]+)$.... – Tarek Fadel Dec 31 '12 at 10:29
Thank you jok! I am glad that you made me aware :) – Fun Jan 2 '13 at 4:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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