There are several reasons to redirect a URL. You may have moved content from one domain to another and need to redirect visitors from the old site to the new one. You may have several domains that need to be directed to a single website. Or you may need to direct a website without the "www" to the proper site. A manual error page and redirect from the old site to the new one is the simplest option, but not always the best one. For a website that already has a lot of traffic and good search results, manual redirection means starting from scratch and building traffic all over again. In addition, visitors may become frustrated by having to click on a link. In the methods discussed here, traffic still goes to the old domain, but is redirected to the new one. In time, as search engines update their databases, the new domain will pick up search results. The difficulty in learning how to redirect a URL depends on what code the website is written in and how much experience you have with editing code.
Method 1 of 5: Prepare the New Domain and Files
Make sure the new domain is directed to your hosted account.
Download the files from the old domain to your local computer. Keep the same directory structure and file names.
Upload the files from the old domain to the new domain.
Click the start button and choose “Accessories” and “Notepad” to open a text editor.
Method 2 of 5: Use a META Command to Redirect the URL
Open the “index.html” or the file that you want to redirect.
Position the cursor after the HEAD tag in the code.
"0" here stands for number of seconds before redirect happens. The www.newsite.com/newurl.html line is the website and the specific webpage that the page is to be redirected to.
Add text to create a custom error page, if desired. Include an announcement that the site has moved. Add the new site name, with a link that can be clicked manually. Change the refresh time so that it allows the reader enough time to read the message.
Save the file.
Method 3 of 5: Use an htaccess File
Find out if your website is running on an Apache server. The htaccess file on an Apache web server handles error requests, redirection and other requests.
Understand 300 http codes. The code "301" is most commonly used on redirected sites, and means "moved permanently".
Type or paste the following code into the text file:
“L” indicates that it’s the last instruction and “R” means redirect, and “301” means a permanent redirect.
Learn how to redirect a url with spaces in the name, dynamic pages, sub-domains and other special features by searching online.
Change “newdomain.com” to the actual domain name.
Click “save.” Change the dropdown list to “all files.” Save the file as .htaccess with no extension.
Rename any existing .htaccess files or html files with the same name to keep a backup copy. Use .htaccessbackup or something similar so that you can find and recognize the file if you need to do a restore.
Upload the modified file to the root directory of the old domain.
Type the old domain name in your web browser. It should redirect to the new site.
Method 5 of 5: Use Other Code
Find out what code your site is written in. There are different commands for each type of code.
How to Redirect a URL
Reviewed by Sufyan Minhas