Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to redirect a request look like


where abc is a fixed directory name and def can be any string.

How can I do this using .htaccess?

share|improve this question
What have you tried? – John Conde Dec 29 '12 at 23:35
You say "redirect", but presumably you mean "internal rewrite"? You want to remain in the address bar? – w3d Dec 30 '12 at 0:40

1 Answer 1

In .htaccess put:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{QUERY_STRING} !id=
RewriteRule ^abc/(.+) /abc/index.php?id=$1 [NC,L]

Note that I included a check for the presence of the id query string parameter to prevent the url from being rewritten.

share|improve this answer

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.