Tag Archive for redirect

Redirect

<script type="text/javascript">
<!--
window.location = "<a href="http://www.google.com/"" >http://www.google.com/"</a>
//-->
</script>

source

redirecting a sharepoint new form

<input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={}')}" />

source

Weiterleitungen mit .htaccess

Redirect /beispielverzeichnis <a href="http://www.domain.de

" >http://www.domain.de
source

Page Redirect Template

<?php
/*
Template Name: Redirect
*/

if (have_posts()) {
  the_post();
  $pattern = '@(https?<a href="://([-w.]+)+(:d+)?(/([w/_.]*(?S+)?)?)?)@';" >://([-w.]+)+(:d+)?(/([w/_.]*(?S+)?)?)?)@';</a>
  preg_match($pattern, get_the_excerpt(), $matches);
  if ($matches[0]) header('Location: '.$matches[0]);
  else echo 'Enter a URL into your page body text.';
}
?>

source

Correct redirect to Location

function redirect($url = './', $permanent=false)
{
if($permanent)
{
header('HTTP/1.1 301 Moved Permanently');
header('Status: 301 Moved Permanently');
header('Retry-After: 120');
header('Location: ' . $url, true, 301);
header('Connection: Close');
}
else
{
header('Status: 200'); // For google chrome
header('Location: ' . $url);
}
exit('If your browser does not support automatic redirect, <a href="' . $url . '" title="proceed">click here</a>.');
}

source

Apache Redirect from *.example.com to example.com

#****************************************
# Apache redirect from *.example.com to example.com
#****************************************

RewriteEngine on

#the domain does not match "example.com"
#note that you need the end-of-string character $ or it wouldn't catch something like "example.com.example.com"
RewriteCond %{HTTP_HOST} !^example.com$

#replace the remainder of the URL: (.*)
#with the full URL: <a href="http://example.com/$1" >http://example.com/$1</a>
#make it a permanent redirect: R=301
#stop rewriting and do the redirection immediately: L
RewriteRule (.*) <a href="http://example.com/$1" >http://example.com/$1</a> [R=301,L]

source

header moved permanently

<?php
header("Status: 301"); # 301 Moved Permanently
header("Location: <a href="http://" >http://</a>{$_SERVER['SERVER_NAME']}/blog");
exit;
?>

source

Follow redirects

function follow_redirects($url,$timeout=5)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061024 BonEcho/2.0");

$html = curl_exec($ch);
$info = array();
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
return $info['url'];
}
return $url;
}

source

Redirect 404 error page to any page

ErrorDocument 404  <a href="http://www.your_site_name.tld

" >http://www.your_site_name.tld
source

URL redirect

<?php header("Location: <a href="http://www.example.com"" >http://www.example.com"</a>); ?>

source