Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

code to capture url

PaullasPaullas is verified member.

Acorn Moderator
Nominet Member
Nominet Registrar
Hosting Provider
Domain Marketplace
Parking Service
Joined
Jul 13, 2004
Posts
5,865
Reaction score
398
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:
General chit-chat
Help Users
  • No one is chatting at the moment.
      Helmuts @ HelmutsHelmuts is verified member.: Good morning all
      Top Bottom