DEV Community

PHP: How to change header randomly on each load?

Leopold Degtyarev on November 04, 2019

THIS IS IN THE START OF INDEX.PHP: <?php if(!isset($_GET['code'])){ header('location: index.php?code=900'); } THIS IS WHERE THE BUTTON I...
Collapse
 
simonced profile image
simonced

As @tmblog said, what error do you have?

And, is that

http://<?php echo $_GET['code'] ?>.dev.test.com

type of URL setup on your webserver?

If you use Apache, maybe you need a rewrite rule to turn that address into:

http://dev.test.com?=code=$1

where $1 is the capturing group of the rewrite rule.

Please provide more details.

Collapse
 
tmblog profile image
tmblog

What's the error you get?

Collapse
 
devdrake0 profile image
Si

Can you update your question with more detail please. If not done in 24 hours, the #help tag will be removed.