Forum Moderators: phranque
I am using a tracking software which generates a unique ID value for each visit to a page. My site uses .htaccess redirects for all links to hide affiliate links.
ex.
Redirect /faq.html [someaff.site.com?x=faq...]
I need to append the unique ID, generated by php as <?php echo var; ?> , to the redirected affiliate link for tracking.
i.e.
[someaff.site.com?x=faq&id=uniqueid...]
I am able to pass the unique ID as a variable to the /faq.html link as:
/faq.html?id=uniqueid
Can someone advise me on using Rewrite to be able to pass this unique ID as needed to the redirect destination?
Kind Regards.
Something like:
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^faq\.html$ http://someaff.site.com/?x=faq [QSA,R,L]
You may or may not need the first line. It can cause errors if it's needed and not present, or if it's not needed and it is present. It can also cause errors when present, even if needed, but in that case, it means you can't use mod_rewrite on that server. Since all this depends on your server's configuration, you have to test to find out. A 500-Server Error response indicates that it's not working.
You only need the second line if there isn't already a "RewriteEngine on" above this new code in your .htaccess file.
All changes from the code you posted are intentional.
Jim
[edited by: jdMorgan at 3:46 am (utc) on Mar. 14, 2008]