Sometimes, it’s necessary to redirect a website or folder on our hosting to a specific URL. There are several simple procedures for creating this redirect, which we’ll detail below.
HTML Redirection
Redirection in HTML is achieved using a META tag, where we specify the URL for the redirection and the time it will take to redirect.
This is the code:
<META HTTP-EQUIV="Refresh" CONTENT="3; URL=https://www.spacewww.com">
Placing this tag between <head> and </head> of our page will result in an automatic redirect to https://www.spacewww.com in 3 seconds.
To redirect immediately, just replace the 3 seconds with zero.
For example:
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=https://www.spacewww.com">
The complete code for an HTML page that performs a redirect is:
<html> <head> <title>Redirección</title> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=https://www.spacewww.com"> </head> <body> </body> </html>
To enable the redirect when your domain loads, place this HTML code on your home page: “index.html,” “index.htm,” or “default.htm.”
PHP Redirection
The PHP code below in the index.php homepage will automatically redirect to the specified page.
<?php header ("Location: https://www.spacewww.com"); ?>