Redirect URL Using PHP - Miftachul Huda Almaftuchin

Redirect URL Using PHP


Almaftuch.in - Redirect url or link often known by directing the purpose of the access link or url in question. In php to do this many ways you can do. One of them is to use php header function, using javascript, using the existing functionality in html. Listen to continue some of the ways you want to share below.

The usefulness of a direct link is usually used to help apabilah main link target being inaccessible or are being carried out repairs. In the world of online business direct link or redirect link is used to direct affiliate links.

Redirect or link url using php function

In php known as the header function to mengaharankan link or url. The trick used is as found in the following php script. In general format phpnya function that header (). The function allows you to send HTTP headers.

<?php
header("Location:www.domain.com");
?>
Redirect or link url using javascript
<script type="text/javascript"> window.location = "http://www.domain.com/" </script>
Another way to use javascript
<script self.location="http://www.domain.com"; window.location.href="http://www.domain.com"; document.location.href = 'http://www.domain.com'; window.location.replace("http://domain.com");" </script>
Redirect url or link using html
<meta http-equiv="Location" content="http://domain.com/">
Above using meta refresh that exist in html. The layout of the script above is among html tag.