Answer the question
In order to leave comments, you need to log in
How to make a redirect script to links from a file in php?
I need something like this. I'm just learning and even this doesn't work for me, please fix it. That is, for any access to any page, you need to redirect to a random page from the file 1.txt
<?php
$subdomen = file('1.txt');
header('HTTP/1.1 301 Moved Permanently');
header('Location: $subdomain');
?>
Answer the question
In order to leave comments, you need to log in
$links = file('1.txt');
shuffle($links);
header('HTTP/1.1 302 Moved Temporarily');
header('Location: '.$links[0]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question