Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

code to capture url

Paullas

Staff member
Joined
Jul 13, 2004
Posts
5,794
Reaction score
339
Hi

I know i have asked for this a few year back but i lost the code so apologies for asking again.

I am looking for some php code that will grab the url from the browser then allow me to forward that url to somewhere else

for example

domain.co.uk - lands on site

then forwards to mysite.co.uk/<domainname>

then when i park say 100 domains on the mysite.co.uk it automatically forwards the domains on.

thanks in advance.

Paul
 
Coding this in the comment box but maybe something along the lines of:

You will also want to parse the url string to prevent attacks which ive not added or just use php's built in functions

Code:
<?php

$location = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI]";

header("Location: $location");

or use a specific location to redirect the user

header("Location: targetsite.co.uk");

?>

This will also pass the URI and any parameters that are appended to the url... for example: https://google.co.uk?source=acorn&name=secnam
 
Last edited:

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Register for the auction
Acorn Domains Merch
MariaBuy Marketplace

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
*the exceptional businesses of our esteemed moderators
Top Bottom