1

I have the following script:

function redirect_to($location) {
    header("Status: 301");
    header("Location: $location");
    exit;
}

if($_GET['check'] === '1') {
    redirect_to('http://www.domain.com?aaa=bbb');
}

For some reason, it's adding a forward slash to the tail end of the domain name. I also tried echoing a JavaScript windows.location, same problem.

http://www.domain.com/?aaa=bbb

How can I prevent this?

spenibus
  • 4,339
  • 11
  • 26
  • 35
Sammy Miri
  • 123
  • 9
  • 2
    This is Browser behavior... http://stackoverflow.com/questions/2581411/do-web-browsers-always-send-a-trailing-slash-after-a-domain-name – Scuzzy Oct 19 '15 at 23:58
  • 2
    You can't: http://webmasters.stackexchange.com/questions/35643/is-trailing-slash-automagically-added-on-click-of-home-page-url-in-browser – dave Oct 20 '15 at 00:01
  • Why is it a problem for you? – scrowler Oct 20 '15 at 00:14
  • becouse the analytics is not tracking correctly. i suspect its due to the url being altered. im redirecting requests to an affiliate network "viglink" and they are not registering the requests. – Sammy Miri Oct 20 '15 at 00:15
  • Are you using one of their monetization API's? Like *monetized URLs* or *monetized links*? – Kuya Oct 20 '15 at 01:20
  • yes. the API formats links into affiliate links. it needs to look like this [http://redirect.viglink.com?key=[API]&u=http%3A%2F%2Fsite.com] but the added **/** after viglink.com seems to break the syntex required – Sammy Miri Oct 20 '15 at 11:37

0 Answers0