A
A
Anton2018-02-27 10:38:54
PHP
Anton, 2018-02-27 10:38:54

How to make a redirect to a page with a Get parameter?

There is a page /personal/order/make/neworder.php that needs to be redirected to /personal/order/make/neworder.php?clear_cache=Y, but to avoid cycling. How to do it in php?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2018-02-27
@ivankomolin

Redirecting is easy:
And in order to avoid cyclicity, you need to check that this get parameter is present, and then do not do an additional redirect. Otherwise, the redirect will repeat again and again, because. it's the same page.
Example:

if (!isset($_GET['clear_cache'])) {
    header('Location: http://blabla.net/personal/order/make/neworder.php?clear_cache=Y');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question