How to redirect a website using a meta tag

The most common way to redirect a website is using an .htaccess file with the RedirectPermanent directive, however you can also redirect using a meta tag in the <head> section of an HTML page. Because an .htaccess file will redirect all pages in a directory, using meta tag redirection is especially useful if you want to redirect only some pages in a directory.

For more information about .htaccess redirection, see How to set up a 301 Permanent Redirect using .htaccess.

How to redirect using a meta tag

To add meta tags in a web page, you need to edit the <head> section of the HTML file. There are two methods you can use to edit HTML files:

  • If the file already exists on your website, you can download it using an FTP client and then edit it using your preferred text editor. If you are creating a new file, create the file in your text editor. When you’ve made the changes in the file, save and upload it. For more information, see Downloading and using FTP software programs.
  • You can also add or edit the file in the cPanel File Manager. For more information, see How to navigate in cPanel’s File Manager.

Open the HTML file and locate the <head> section near the top of the file. Add the following line above the <title> tag, replacing www.example.com with the URL you want to redirect visitors to:

<meta http-equiv="refresh" content="2;url=http://www.example.com/" />

The full <header> section would look similar to this:

Save and close the file. Open the page in your web browser to test the redirection.

More information

If you have any questions or need help, you can always contact HostPapa Support by opening a support ticket. Details about how to open a support ticket are here.

Was this article helpful?

Related Articles

Leave A Comment?