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

what's the use of back references in Rewriterule in mod_rewrite?

link|improve this question

38% accept rate
feedback

closed as exact duplicate by Chris S, Iain, Ben Pilbrow, Scott Pack, Ward Feb 16 '11 at 20:23

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

1 Answer

See this for excruciating details:

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

Backreferences are used to address specific match-groups in RewriteRule segments.

RewriteRule ^/blog/(2008|2009)/(.*)$   /newblog/$1/$2

(2008|2009) is a reference, and $1 is the backreference. Same for (.*) and $2. As you can see, they're used for URL rewriting. See the "RewriteRule matching syntax" section of the answer I linked to.

link|improve this answer
feedback

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