24/7 Support (425) 274-4500 | Submit a Ticket | Who is my Reseller?

How to Create a 301 Redirect on a Domain

Article Number: KB 352

Product: DNS/Nameservers

Problem

How do I create a 301 redirect on my domain?

Solution

Host Records Method

You must be using our DNS servers to use this method (see How to Change Domain Nameservers (DNS)). Set the below host records to perform a 301 redirect to http://www.example.com/:

 

Host Name Record Type Address
www URL Redirect http://www.example.com/?redir_mode=301
@ URL Redirect http://www.example.com/?redir_mode=301
* URL Redirect http://www.example.com/?redir_mode=301

 

Please see the article, Forward, Redirect or Point Your Domain/Sub-domain (Change Host Records) for full instructions on setting host records.

Scripting Method

In order to create a 301 redirect you will need a place to host an index.asp or index.php file.

If you have already signed up for eNom's web hosting you can place this file in your eNom hosting account. You can also point your domain to another host by modifying your name servers or host records (see How to change domain name servers (DNS) and/or Forward, Redirect or Point Your Domain/Sub-domain (Change Host Records)).

To purchase a hosting account with us, please see the article, How to Purchase Web Hosting.

To create the redirect, use the following code and place it into a file named index.php or index.asp. Then, place the file into the root directory for your domain in your hosting account (see Web Hosting: Upload Files to Web Hosting Account).

You can modify the location in each file, http://www.example.com, to any URL you choose.

301 Redirect in PHP

<?php

Header( "HTTP/1.1 301 Moved Permanently" );

Header( "Location: http://www.example.com" );

exit();

?>

More Information

 

Last Updated: October, 2015

 

Still looking for help? Call us at 1-425-274-4500 or click here to open a ticket online.