0

I'm using apache2 on Linux, and I'm wondering if it is possible to show a random index file to users that's visiting the site WITHOUT they see it so it always says: Https://example.com regardless if the system loads index1.html or index2.html

or is it possible to have an index.php that somehow loads a random first page?

1 Answers1

0

If you're willing to use PHP, then you can create an index.php file with this content:

<?php
    $files = glob(dirname(__FILE__) . '/*.html');
    print_r( file_get_contents($files[rand(0, count($files) - 1)]) );
?>

In the same directory, create a bunch of .html files. Now visit the site. Each page load will grab a random .html file as source.

Here's something you can toss in placeholder HTML files to test the two-line answer:

<html>
    <head>
        <title>Page 1</title>
    </head>
    <body>
        <p>This is page 1</p>
    </body>
</html>
matigo
  • 1,321
  • 1
  • 6
  • 16