M
M
Maxim Spiridonov2014-11-22 14:27:10
PHP
Maxim Spiridonov, 2014-11-22 14:27:10

How to make a redirect from a non-existent $_GET parameter?

I have the following index.php structure , which is responsible for my $_GET addresses.
$param[0] is the first get parameter, say site.ru/news. Here I did a check for non-existent addresses where $param[0].
Now the task is to redirect to the main page from a non-existent $param, where it can be $param[0,1,2,3], for example site.ru/news[0]/good[1]/jek[2]/ass [3 - non-existent parameter, it is from it that you need to redirect to the main one.]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2014-11-22
@gbg

You need to send 301 HTTP response: www.kobzarev.com/programming/301-moved-permanently.html

<?php
header("Location: http://www.example.com", true, 301);
exit();
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question