Redirect all link in site to redirect page
This question already has an answer here:
To do this follow these steps:
1. Link is to make using target blank.
Example:
Open link in a new window or tab:
<a href="alvinshortener.com/index.php?url=www.google.com" target="_blank">Visit </a>
inside index.php write:
<?php
if(isset($_GET['url'])){
header("Location: $_GET['url']");
}
?>
perhaps I may help. in ASP.NET, we use AdRotator to redirect the page. Meaning you can have one page like the "hyper-hippo.net" build with the adRotator.
This is an example: in ASP.NET
$sql = mysql_query("SELECT * FROM sites WHERE sites ='" . $_POST["sitess"] . "'");
$id = mysql_fetch_array($sql);
<p><a href="ad1.xml" target="_blank">View XML file</a></p>
This is another example in PHP :
$ads = array("ad code goes here", "more ad code", "more ad code");
shuffle($ads);
print $ads;
This is another one in HTML
<div id="rotator">
<img class="ad" src="#" />
<img class="ad" src="#" />
<img class="ad" src="#" />
<img class="ad" src="#" />
</div>
This is another one in JS + HTML
<div id="rotator">
<img class="ad" src="ad_banner1.png" />
<img class="ad" src="ad_banner2.png" />
<img class="ad" src="ad_bannerN.png" />
</div>
<script type="text/javascript">// Fisher-Yates Algorithm written by Gio Borje <http://www.giocc.com>
(function() {
// Get the list of ads on your site
var ads = document.getElementsByClassName("ad");
// Used for swapping in the algorithm
var tmp;
// Random index to swap with
var randomIdx;
// Random sorting algorithm
for (var i = 0; i < ads.length - 1; i++) {
randomIdx = i + 1 + Math.floor(Math.random() * (ads.length - i));
tmp = ads[randomIdx].src;
ads[randomIdx].src = ads[i].src;
ads[i].src = tmp;
}
})();</script>
I Hope this Help!!!
你可以在html头部使用meta标签,就像这样
<meta http-equiv="refresh" content="0; url=http://example.com/" />
链接地址: http://www.djcxy.com/p/34706.html
下一篇: 重定向站点中的所有链接以重定向页面