Quick Tip: Split Testing with Apache

You don't have to use a powerful tool like Google Optimize for simple URL split tests, but you can also solve Apache via .htaccess. The following code snippet distributes https://vielhuber.de/test1.php (variant 1) and https://vielhuber.de/test2.php (variant 2) its visitors equally to both versions for the two pages. The randomization is based on the current server time.


Returning visitors always see the website last viewed (via session cookie). The concept can easily be expanded to include several variants or a central URL that is distributed to sub-pages.