When redirecting from http to https, the query becomes double.

Asked 2 months ago, Updated 2 months ago, 2 views

I created a wordpress site using kusanagi.
Originally, I changed the site I was operating to WordPress, but the previous site was a site with a php query, and this time I changed it to a static URL in WordPress.
If there is no query such as top.php, it can be redirected to /top/ successfully, but if the query is plant.php?oyasai_id=1, it will double with plant.php?oyasai_id=1?oyasai_id=1.
At first, we created plant.php on the server side of https, got it, looked at the parameter values, and set the redirect in location.

header("HTTP/1.1301 Moved Permanent";
header('Location:https://example.com/oyasai/ninjin/', true,301);
header("HTTP/1.1301 Moved Permanent";
header('Location:https://example.com/oyasai/tamanegi/', true,301);

If you access plant.php?oyasai_id=1 with https, you will be redirected successfully to the specified page.

↓ Redirect

Access with http only causes double queries.

↓ Redirect

As it does not work well, I am not redirecting plant.php at the moment.
Regardless of whether plant.php is present or not, the query will be double, so I think the above situation is happening in the part of kusanagi that redirects from http to https.
If possible, I would like to redirect the query without duplication.
Thank you for your cooperation.

php wordpress

2022-09-30 14:24

1 Answers

I solved myself.
The preg_match redirect was successful.

2022-09-30 14:24

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.