PHP and HTML redirects

If you do not wish to use the .htaccess file to redirect your visitors, you can use another option - a PHP or an HTML file which will perform the actual redirection. Below are examples for both programming languages:

  • For PHP, create a file (index.php for example) and add the following lines in it:

<?php
header( 'Location: http://www.yoursite.com/redirect_location' ) ;
?>

  • For HTML, create a file (index.html for example) with the following content:

<META HTTP-EQUIV="Refresh"
CONTENT="0; URL=http://www.yoursite.com/redirect_location">

Here you have the option to delay the redirect by increasing the CONTENT variable. For example CONTENT=5 will delay the redirect for 5 seconds.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Brute Force Attack – What it is and How to Block It

Brute-force is a method of guessing your password by trying combinations of letters, numbers and...

What is pdftoppm and is it supported by Hostlantern?

Pdftoppm is a library that handles the conversion from Portable Document Format (PDF) files to...

How to clear your Internet browser’s cookies?

Sometimes you may need to clear the cookies saved by your browser. Basically the cookies...

Hacked Website

The most common reasons for a hacked (defaced) website include: - Outdated web application....

How to clean my files from malicious code?

If your website has been hacked and malicious content has been inserted into your files, you...