0

Let me preface this by saying that writing .htaccess files drives me completely insane...

I've got a sales website with a bunch of affiliates that should redirect to a shop site and then send the user back to the original sales site.

So what I want to do is have something like:

www.example.com/item/randomaffiliatenumber

(the "promo" directory doesn't actually exist).

redirect to:

subdomain.shop.com/item/randomaffiliatenumber

I mean I suppose I could MAKE an "item" directory with the same contents as "/" but that shouldn't be necessary. The main thing I want to do is have the affiliate code be passed to the shop site.

I tried:

RewriteRule ^item/(.*)$ http://subdomain.shop.com/item/$1

...but that didn't work.(Gave me a 404 saying "promo" wasn't found).

mystic cola
  • 1,465
  • 1
  • 21
  • 39

1 Answers1

0

Meh... it was easier than I thought:

RewriteEngine on
RewriteRule ^item/(.*) https://subdomain.shop.com/item/$1 [NC,QSA]

Just needed to make those few adjustments and it worked. So I was actually closer than I thought.

In case anyone is wondering (.*) turns into the variable $1 in the second half. That should be enough to get you to where you want to go.

mystic cola
  • 1,465
  • 1
  • 21
  • 39