on air

PHP Redirection | Shorten URLs.

back home » Scripting Tutorials » PHP » PHP Redirection | Shorten URLs.

Users' Skepticisms Cause By Longer URLs Affect Traffic And Sales.

Some users become very skeptic, when they move their mouse over a link, and it shows something unimpressionable, as browsers reveal links' URL before a user will click on it. They'll simply ignore it and move forward.

In this case, sales potential will reduce, using a longer and suspicious link in promotions. However, due to the information needed by Affiliate providers, to enable 'em know where a recommendation is coming from. They are forced to provide their affiliates with longer URLs, which sometimesl contain an Affiliate ID and so on.

This is whereby the php redirection function needs to come in action. It will enable you shorten the URL to a friendly one.

Create Shortened URLs Using PHP Redirection.

To shorten a URL, you can simply copy your longer Affiliate link, and replace the xxx inside the .php script below with it.

Save it under your choice of a friendly name .php, upload it to your server. And the next step will be, instead of using your Affiliate link directly on your site. You'll in the future link to the .php file. And this will redirect users to the offer site easily.

See the illustration below.

Before: Copy PHP script into notepad:

header( 'Location: xxx?');

After: Replace xxx with your longer link, it should look somehow like this or longer:

header( 'Location: https://sell.com/checkout.php?PD=1&;QTY=1&;AFFILIATE=1?');


Make sure nothing is placed before the code, else it won't work. The .php file should contain only the code with your longer link as explained above.

Replace only the xxx, and avoid changing anything else.

This PHP redirecting script can be used for any URL without exception. However, your file must be uploaded onto a server supporting PHP scripts. Ask your provider if their server support PHP and it's activated, then you'll enjoy using it!

Get The Original PHP Redirecting Script Again.

Note: Again, this's how the original redirecting script looks like. You'll just replace [xxx] with your Affiliate link [Longer link].

See the original script below.

header( 'Location: xxx?');

Related Articles, Links And Tips

Related Article is the .htaccess 301 redirection.

There are tons of URL shortener on the net these day, however most of them aren't user trusty. You may use the Google URL Shortener, it's a very cool tool and user friendly, it even allows you to track, clicks and referrers of any shortened URL.

For further information on PHP, you may visit https://php.net to learn more.

Don't forget to recommend this page to your friends, using the mega phone button in the link right below that says, Tell a friend 'bout this page. Just scroll to the bottom and turn right.

Easy Redirection In PHP.


Man will give you worldly powers, and make you feel on top of all, note this is temporally and could be redrawn at anytime sending you back to the ground floor of life. However, the Lord Almighty, the one and the only rightful ruler of the Universe, blesses everlastingly.


Knowledge is Power, but Power is not Knowledge. Wisdom is the truthful Power that identifies the Knowledge within the man. And only, I repeat 3x. Only the almighty God has the power to bless the man with his Wisdom forever.

To achieve the Lord's blessings, cease not praying daily, asking for his Wisdom, and you'll be blessed abundantly...


Spyera Phone

Spyera Phone version is software that you install on a smart phone to monitor everything happening on the phone. After installation, SPYERA secretly records events (sms, call history, phone book, location, emails, What's App messages, IM, Facebook Chat, Skype, See photos taken and many more...) that happen on the phone and delivers these information to a web account, where you can view these reports 24/7 from any Internet enabled computer or mobile phone. SPYERA also allows you to listen to the surroundings of the target mobile , listen to the phone conversation and to know the location of the device.


Please, Kindly Donate What You Can, Enabling Us Pay Hosting And Domain Costing, And Do More.

Please Donate