Hostwinds Tutorials
Search results for:
Table of Contents
Tags: htaccess
There are two types of redirects, a permanent and temporary redirect. We will be taking a look at temporary redirects. If you'd like to learn how to utilize a permanent redirect, please consult our guide, which covers this in detail: Set a permanent (301) redirect using .htaccess
The first thing you'll need to do (if you haven't already) is creating a .htaccess file. If you're not certain how to create a .htaccess file, no worries, we have you covered with our guide: Creating and editing a .htaccess file. Once the .htaccess file has been created, you'll need to edit the contents of this file using the method that best suits your needs. Typically the options available to edit your .htaccess file are as follows.
Regardless of the method you're using, the code you'll be adding is the same. To redirect your entire website to a different URL, you'd use the following entry in the .htaccess file:
Redirect 302 / http://newwebsitehere.com/
The above will redirect your current website to a new site of your choosing. This is excellent if you're rebuilding your site and you'd like to direct visitors to a temporary site or landing page. To redirect a portion of your site, you'd place the following code in your .htaccess file:
Redirect 302 /old-page.html http://newsitehere/new-redirected-page.html
Once you're satisfied, save the file, and the redirect should be in place!
Written by Michael Brower / June 22, 2017