S
S
sasmoney2021-08-13 14:41:16
PHP
sasmoney, 2021-08-13 14:41:16

How to redirect php referral link?

There are a lot of links with different i at the end https://test.ru/?i=717956 https://test.ru/?i=123 https://test.ru/?i=1234
How to redirect them to the site https://dom.com/?i=717956 https://dom.com/?i=123 https://dom.com/?i=1234

Do not redirect https://test.ru/

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
infinityfreenom, 2021-08-13
@sasmoney

if ($i = filter_input(INPUT_GET, 'i', FILTER_VALIDATE_INT)) {
    header('location:  https://dom.com/?i=' . $i);
    exit();
}

S
SagePtr, 2021-08-13
@SagePtr

If using .htaccess, judging by the tag, then something like this:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^i=\d+$
RewriteRule ^$ https://dom.com/ [R=301,L,QSA]

A
Alexander Interesting, 2021-08-13
@Swimergg

index.php-

<?php
echo file_get_contents('https://dom.com/?i='.$_GET['i']);
?>

Why not? :D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question