How do I redirect one Web page URL to another?
If you have a “domain name only” plan with us, you can redirect your site sites using our control panel.
If you have hosting service with us, you’ll need to do it a little differently. The Apache Web server we use allows you to redirect one URL to another using .htaccess files.
To do this, add the Redirect command to the .htaccess file at the top level of your site. For example, you could add a line like this:
Redirect 302 /index.html /blog/
This line will redirect any request for your home page to the “/blog/” page on the same site. (The “/index.html” will match any request for your home page, overriding any existing default index page in that folder, regardless of its name.)
The new destination URL can omit the host name and begin with a slash, as in the example above, or it can be a full URL. For example, you could use a line like this:
Redirect 302 /folder/oldpage.html http://www.example.org/newpage.html
In this example, whenever someone accesses “http://www.example.com/folder/oldpage.html”, their Web browser will take them to “http://www.example.org/newpage.html” instead.
If you use a full URL as the destination, it can be an unrelated Web site, including one that’s not hosted on the Tiger Technologies servers:
Redirect 302 / http://www.example.org/
That line will redirect any URL requested on your site, because the Web server simply checks whether the URL path the visitor requests begins with the text you specify (“/” in this case). All URL paths begin with “/”, so that line matches all of them.
If the visitor’s request includes an additional path as part of the URL, the additional path will be added to the destination. So if the visitor in that last example requests “/about” on your site, they’ll be redirected to “http://www.example.org/about”.
Adding multiple redirects
If you need to do multiple separate redirects, simply add as many separate Redirect lines as you need.
For example, if you want to redirect “/about” to one place and “/blog” to another, you could add these two lines to your .htaccess file:
Redirect 302 /about http://www.example.net/our-company-info/ Redirect 302 /blog http://www.example.org/MyNewBlog.html
Using a “301 permanent” redirect
The examples above all use a “302 temporary” redirect. That tells search engines that this redirect might not always happen in the future, and that they should keep checking the original page URL.
If you’re going to permanently stop using the old URL, and you want to make sure that search engines only “know about” the new site, you’d use a “301 permanent” redirect instead. Just change the “302” in the examples to 301, like this:
Redirect 301 /index.html /blog/ Redirect 301 /folder/oldpage.html http://www.example.org/newpage.html Redirect 301 / http://www.example.org/
Want more details?
The Apache redirect documentation explains more complicated options, such as using RedirectMatch to match more complicated URL patterns.