There are various reasons why you might want to redirect a URL, along with several basic approaches to achieve it. For a website with significant traffic and strong search engine rankings that needs to change its domain name, redirection is the ideal choice during this transition. Visits to the old domain will automatically redirect to the new one. Over time, as search engines update their databases, the new domain will appear in search results. URL redirection is useful when you need to redirect specific URLs to another web address or simplify complex URLs. The method of URL redirection depends on the website's programming code and your confidence in editing that code.
StepsWrite a 301 Redirect Code in .htaccess

Identify if the website runs on an Apache server. This is necessary to proceed with the .htaccess method—check with your web provider if you're unsure.

Locate and download the .htaccess file. The .htaccess file is what your web provider checks for handling errors, security, and redirecting page requests. Check the root directory (where all website files are stored) and download the file for editing.

Create the .htaccess file. If you don't see the .htaccess file in the root directory, you can create it using Notepad (or a similar text editor). The file code is provided in the next step.
- Ensure the file name starts with a "."
- Make sure the file has no extension (e.g., ".com" or ".txt").

Enter the code. Paste the following code into the .htaccess file:
.redirect 301 /old/oldURL.com http://www.newURL.com- In the code, "oldURL.com" is the website from which visitors are redirected, while "http://www.newURL.com" is the website they are redirected to.
- There must be a space between "oldURL.com" and "http://".
- Do not add "http://www" to the (old) URL in the first part of the code!
- The "301" code is commonly used for permanent redirects. Research the "300" codes for other functionalities.

Set the new destination URL. Replace "http://www.newURL.com" with the domain address you want visitors to be redirected to.

Save the .htaccess file. Under the "all files" option, save the .htaccess file without any extension.

Create a backup. Rename the .htaccess file and its HTML counterpart to keep a backup. For example, use a name like .htaccessbackup so you can easily locate and restore the file if you need to revert to the previous code.

Upload the modified file to the root directory of the old domain. Now you can make further code adjustments if needed, place the file in the old URL to ensure it reads and redirects as intended.

Test the redirection. Open a private browsing window and type the old domain into the address bar. If everything is done correctly, the website will redirect to the new page.
- Use a private browsing window to ensure your browser accesses the new redirect instead of relying on cached data (stored data for faster website access).
- In the private browsing window, you can clear your browser's cache through the settings menu. For more details, read the article Clear-Browser-Cache.
Use a Redirection Service

Check with your web provider. If you're unsure about your coding skills or prefer to redirect URLs without modifying the code, you can use redirection services, and your web provider might offer one. Many web providers include redirection services and support to help you achieve your goals. Verify this feature with your current provider or contact them directly for available options.

Choose an intermediary service. If your web provider doesn’t offer redirection services, you can opt for a third-party solution. Depending on the type of redirection you need, you may find free services available.
- Many services allow you to configure redirection options, such as the type of redirect (permanent or temporary) or whether query parameters are passed along.
- Only a few services support HTTPS (secure) path redirections.

Follow the redirection service instructions. Typically, these services are user-friendly and provide step-by-step guidance to make the process straightforward.
- Note: In some cases, you may still need to edit the DNS (Domain Name System) records for the domain you want to redirect. This can usually be done through your web provider’s site.

Update DNS records. The intermediary redirection service will notify you if you need to access and modify these records through your hosting account.
- Instructions for editing DNS records at this stage depend entirely on the service you’re using, and both the service provider and your web host typically offer simple guides.

Access the code of the page you want to redirect. This is another method that involves directly altering the page’s code. You’ll need to download the file associated with the URL
from which you want to redirect.
- Note: In most cases, using Meta commands for redirection is not ideal. Websites with Meta redirection code are often flagged by search engines as it’s considered a less transparent technique.

Open the code for editing. Use Notepad or a similar text editor to open the code file of the page. Save a copy before making any changes as a precaution.
Edit the code. The Meta code starts after the "head" tag (<head>) in the page's code. Insert: .<META http-equiv="refresh" content="0;URL=http://www.newsite.com/newurl.html">
- There should be a space between "refresh" and "content".
- "0" represents the number of seconds before the redirect occurs.
- "www.newsite.com/newurl.html" is the address of the page you are redirecting to.
- You can create a custom error message or notification that your site has moved, but this may draw unwanted attention to the redirect!

Save the file and re-upload it to the old page. If you're redirecting traffic from the old URL, it’s likely that other changes have already replaced parts of the URL code (e.g., removing page content). It’s crucial that the current URL code includes the meta redirect tag.

Test the redirect. Enter the URL into your browser’s address bar or use a search engine to find it. The website should immediately redirect to the new URL specified in the code without any notifications or interruptions.
Use a Different Programming Language

Identify your website's programming code. Each programming language has slight variations in redirection code. If you're unsure about the answer to this question, contact your web provider for more information.

Research alternative redirection codes. There are various encoding commands for each language, with multiple options to explore within each. Search online to determine the appropriate code for your website.
- For example, you can easily find PHP, ASP, ColdFusion, and Javascript redirection codes on the web.

Test the redirection. Once you’ve found the right code for your site, the implementation process is similar to other coding methods. Don’t forget to test the redirection by accessing the (old) URL to ensure everything works as planned.
Tips- FrontPage users (a well-known website administration tool) need to adjust the .htaccess file within the _vti_bin and its subdirectories _vti_adm and _vti_aut.
- While some websites use error pages to explain URL changes and include clickable redirect links, this method is less effective than automatic redirection and may reduce traffic to the new page.