Jump to content

Rewrite URL / Tracking


EuroLee

Recommended Posts

Hey All, this is my first post here.

I need a little help with some php code I'm working on, I'm new to PHP so please bare with me if what I call things isnt correct.

What Im trying to do is take a tracking code from my payment processor and, rather than give affiliates the code given by the processor, give them a unique URL they can send site visitors too instead.

The code I have from the payment processor is as follows:

That is the coding given to affiliates to track sales they generate but, what I want to do is offer them a link that looks like this:

https://www.domain.com/XXXXXX/

Is this something that I can do utilizing PHP or do I also need to include some .htaccess to achieve this?

Thank you in advance for any assistance you might be able to offer, I look forward to reading and responding to any questions you may have.

Quote

 

 

Link to comment
Share on other sites

You need both .htaccess (to tell the web server how it should handle these custom URLs) as well as PHP (to know what to do with the code in that URL).

The exact details of how you do that varies between applications. Nowadays, most sites already have the .htaccess stuff in place because they're already using URL redirecting - such as this page, whose URL is /topic/$number-$string which "redirects" to some internal PHP script.
If you don't have that already then fine, you just need to add something for these URLs specifically.

But there's some preliminary work you have to go through first: create a PHP script which is capable of taking a "XXXXXX" code and doing whatever is necessary. You can just hardcode it into your script to test with,

<?php

// todo: $code = value from $_GET
$code = "XXXXXX";

// ...

URL rewriting will transform /XXXXXX into something like /path/to/script.php?code=XXXXXX.

Speaking of, /XXXXXX isn't a great choice as it will be ambiguous with any other page at the root of your website - how do you tell whether the "XXXXXX" thing is an actual page or a tracking code?
So I suggest giving it a "directory" of something like /track/XXXXXX. The "/track/" makes it unique so it won't conflict with anything else.

Link to comment
Share on other sites

That makes sense, kind of.

My train of thought was if I get affiliates linking directly to /XXXXXX/ and that just has the index.php page in for the site, when the visitor clicks a link, it will take them to the join page where the affiliates ID will be presented along with transaction information to credit them with a sale.

The other pluses of having it redirect to https://www.domain.com/XXXXXX/ would be that i should, in theory help with search engine rankings to that specific domain name and, its a lot easier for affiliates to remember a short link such as that one, than the one provided by the payment processor to track their affiliate sales.

Ill take a look at htaccess redirect stuff and see if I can figure out the code needed to add that to the server on all of the domains where I want to implement this.

Link to comment
Share on other sites

4 minutes ago, EuroLee said:

My train of thought was if I get affiliates linking directly to /XXXXXX/ and that just has the index.php page in for the site, when the visitor clicks a link, it will take them to the join page where the affiliates ID will be presented along with transaction information to credit them with a sale.

Users aren't going to care about what the URL looks like. The only purpose of creating friendly URLs like this is so that if a human being looks at it then they can understand what it means, and that matters if you're giving them these links in something like an email.

Have you ever looked at Amazon URLs with referrer codes? If one of the biggest sites on the internet isn't doing friendly affiliate IDs then it's just not going to matter much.

So take your intentions with a grain of salt, and consider that having a page with an "unfriendly" URL is going to be 1000x better than having no page at all.

4 minutes ago, EuroLee said:

The other pluses of having it redirect to https://www.domain.com/XXXXXX/ would be that i should, in theory help with search engine rankings to that specific domain name and, its a lot easier for affiliates to remember a short link such as that one, than the one provided by the payment processor to track their affiliate sales.

1. Search engines don't care about URLs either. They did once long ago, but technology and practices have advanced far since then. Concepts like semantic page markup and mobile friendliness are far more important.
2. Why would you want search engines to index these URLs/pages in the first place? One of the main points of an affiliate link is that the affiliate alone controls it - if it starts showing up in search results then you lose a lot of the benefits.
3. You haven't mentioned yet what these URLs/pages actually do. Are you redirecting? Then SEO is mostly irrelevant. Are you displaying content? If the content is the same for different affiliates then your site will lose in SEO because they're going to think you're a content farm.

4 minutes ago, EuroLee said:

Ill take a look at htaccess redirect stuff and see if I can figure out the code needed to add that to the server on all of the domains where I want to implement this.

Forget the .htaccess stuff for the moment and implement the PHP page first.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.