URL redirection can be used for many purposes. Maybe you have just went the content of a webpage to a further webpage or domain and you want to redirect the frequent visitors of your website to the new webpage involuntarily. The knowledge of practice of redirecting URL is also useful if you want to shorten a long affiliate URL.
Not more than are several ways you can use to redirect visitors to any URL you want:
- Using Meta Tag
The tag for doing it is:
META http-equiv = “refresh” content = “0; URL = anydomain.com/destination.html”
Just place the tag above between the HEAD and /HEAD tags in a webpage. That way, when a name visits the webpage that contains the tag, he will be redirected to destination.html involuntarily. Don’t forget to include the “http” protocol which has been omitted.
In order to find out how many visitors have been redirected you may try to replace the destination URL with a tracking URL.
- Using PHP code
In PHP, “Header” is a built-in function that is evenly used to accomplish this task. This function can be used to redirect visitors depending on a specific condition. For instance, you can use this function to redirect a name to a webpage after submitting his right username and password.
Here is the code:
header(”Place: anydomain.com/destination.php”);
where destination.php is the destination URL.
Keep in mind that you have to save the file with .php extension in order to make it works.
- Using the redirect URL facility from your hosting service
Many web hosting air force provide a facility that you can use to redirect pages of your site to any url you want. This way, you only have to fill the source and the destination URL in a blank form and hit the submit button.
- .htaccess
You can also use your .htaccess file for this purpose as long as the hosting company you are using allows you to access this file. The code not more than will redirect visitors from oldpage.html to newpage.html.
Redirect /directory/oldpage.html anydomain.com/directory/newpage.html
Just place the code in your .htaccess file.
Now, how if you want to show a URL without using .html or .php extension? First, place the Meta Tag or the PHP code above in a file and name it as index.html or index.php. Then make a subdomain and upload the file into it. When a name visits the subdomain, he will be redirected to the destination URL.
There are really other techniques of redirecting URL with different advantages and disadvantages. For instance, with Domain Forwarding you can forward your domain name to a URL. Domain Masking that looks similar with Domain Forwarding can hide a URL with your own domain name so the real URL will not be showed in the address bar of your visitor’s browser.
Whatever practice of url redirect you intend to use, permanently choose the one that would best fit your needs.