-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect.php
29 lines (28 loc) · 1.38 KB
/
redirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/*
intermediate redirect to domain
If you are using a local websrver like OpenServer
this file needs to be put in localhost and set up a redirect through it because
google allows you to specify only localhost in redirect_uri.
redirect_uri the redirect address must contain target - the final target for the redirect
like this:
'redirect_uri' => 'http: //localhost/redirect.php? target = http: //mydomen/search.php'
*******************************************
промежуточный редирект на домен
Если вы используете локальный websrver типа OpenServer
этот файл нужно положить в домен localhos, затем настраивать редирект через него тк.к
google позволяет указать в redirect_uri толкьо адрес localhost.
redirect_uri адресе редиректа должен быть прописан target - коенчная цель для редиректа
например так:
'redirect_uri' => 'http://localhost/redirect.php?target=http://mydomen/search.php'
*/
if( $_REQUEST['target'] ){
$target = $_REQUEST['target'];
unset($_REQUEST['target']);
$query = http_build_query($_REQUEST);
$url = $target.'?'.$query;
header("Location: $url");
}else{
echo "No target for redirect.";
echo '<pre>$_REQUEST: '; print_r($_REQUEST); echo '</pre>';
}