ginocote Posted August 30, 2006 Share Posted August 30, 2006 Hi,I have this scripts and i want to take the result to redirect to a webpage.[code]<?php$url = trim($_GET["url"]);$a = str_replace('www.', '', parse_url($url));echo 'Lien vers <a href=http://www.toolurl.com/search-domains.php?url=www.' . $a['host'] .'>'. $a['host'] . '</a>';?>[/code]this is my test page: http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/index.phpmany test on this page: the last two result are the good one.i want to take a full url and redirect it to the www.toolurl.com search: for this example it will redirect to this page: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.comresume:when someone will go to: http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/index.phphe will be automaticly redirect to: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.comThank you to help Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/ Share on other sites More sharing options...
ginocote Posted August 30, 2006 Author Share Posted August 30, 2006 Any help for this redirection? Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/#findComment-83143 Share on other sites More sharing options...
ronverdonk Posted August 30, 2006 Share Posted August 30, 2006 Why don't you make an INDEX.PHP on your [url=http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/]http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/[/url]site and put the following code in:[code]<?phpheader("Location: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.com");?>[/code]Or do I misunderstand the question?When you want to break down the url, you can use the parse_url command, see [url=http://nl3.php.net/manual/en/function.parse-url.php]http://nl3.php.net/manual/en/function.parse-url.php[/url]Ronald 8) Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/#findComment-83168 Share on other sites More sharing options...
Jenk Posted August 31, 2006 Share Posted August 31, 2006 Use a 301 redirect in .htaccess. Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/#findComment-83230 Share on other sites More sharing options...
ginocote Posted August 31, 2006 Author Share Posted August 31, 2006 [quote author=ronverdonk link=topic=106289.msg425044#msg425044 date=1156976318]Why don't you make an INDEX.PHP on your [url=http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/]http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/[/url]site and put the following code in:[code]<?phpheader("Location: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.com");?>[/code]Or do I misunderstand the question?When you want to break down the url, you can use the parse_url command, see [url=http://nl3.php.net/manual/en/function.parse-url.php]http://nl3.php.net/manual/en/function.parse-url.php[/url]Ronald 8)[/quote]I need a php scripts in this redirection to parse the url for this example:http://www.phpfreaks.com/forums/index.phpand transforme it towww.phpfreaks.comwitch scripts i should use to take my result www.phpfreaks.com and send it to the redirect script?And the redirect scripts to work should be the first line of a web page, we can send the result www.phpfreaks.com at the beginning of the page. Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/#findComment-83443 Share on other sites More sharing options...
redarrow Posted August 31, 2006 Share Posted August 31, 2006 Is this what you mean.test.php[code]<?phpecho"<a href='test_result.php?get=url&url2=http://www.google.com'>go to google</a>";?>[/code]test_result.php[code]<?phpif($_GET['get']=="url"){$url2=$_GET['url2'];header("location: $url2");}?>[/code] Link to comment https://forums.phpfreaks.com/topic/19182-redirection-and-parse_url/#findComment-83461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.