views:

397

answers:

3

I want to take the url: http://www.mydomain.com/signup-12345

And actually give them: http://www.mydomain.com/signup/?aff=12345

I have NO history with mod_rewrite, HELP!

A: 

I don't know. But, in order that this be more helpful when searching, please rephrase your question.

Kevin Conner
A comment would be more suitable than an answer, I think.
Eli Bendersky
+5  A: 

Try this :

RewriteRule ^/signup-(\d+)/$ /signup/?aff=$1 [I]

CodeRot
+2  A: 

Something that I found relatively hard to find out was how to do the reverse of what you are doing, whereby you need to find out the value of part of the query string.

So for example:

If you wanted to rewrite the Url: http://www.example.com/signup-old-script.asp?aff=12345

to: http://www.example.com/signup-new-script.php?affID=12345

you could use:

RewriteCond %{query_string}& ^aff=((.+&)|&)$   
RewriteRule ^/signup-old-script.asp$    /signup-new-script.php?affID=%2 [L,R]

Notice the % sign in the rewrite rule instead of the $ sign.

I had to do this so I could support old flash maps in a new site that had links to ".cfm" files with an ID in the query string.