使用参数将HTML重定向到PHP

I am no web developer and this may be a simple(yet unusual) task, but I have found no solution so far.

On my Webserver (Apache2), I have two files:

index.html

test.php

The test.php needs some parameters to function properly, so I have to call the file this way for example:

www.mydomain.com/test.php?parameter=true

My goal is that I can call the test.php file, when I open the index.html file. For example:

www.mydomain.com/index.html?parameter=true

This should redirect to/execute test.php AND pass the parameter. Is there any solution for this?

Please note: The index.html file is a must, I may not replace it with index.php or anything else.

You're gonna have to use JavaScript for this, but it is doable. On the page load, call something like this:

location = "test.php?" + location.search;

Not sure whether it will be a good practice or no but here I have found something which you may try.

Since your execution will start from the html file, you can include a JavaScript code in it and write a code to redirect to necessary URL

e.g. In your html, you can include a script as follows -

<script type="text/javascript">
    window.location.href = "http://www.yourdomain.com/test.php/?parameter=true";
</script>

You may also add script to replace the 'index.html' with 'test.php' in your current URL via JavaScript which will redirect you to desired place.

Inside of the '<head></head>' tags of the index.html page, place the following code:

<script type="text/javascript">
    window.location = "http://www.yourdomain.com/test.php"  + window.location.search;
</script>

The 'window.location.search' part gets the query string from the URL. The query string is the part of the URL that follows and includes the question mark (?).

Now, everytime someone comes to your page they will immediately be redirected to test.php with the all the accompanying parameters.