How TO – Redirect to Another Website URL

Website redirects point the old URL to the new page. If someone enters or clicks on the original URL, you’ll be taken to the page where you set up the redirect.

This allows visitors to find something related to what they were originally looking for, rather than getting to a 404 page. It also prevents you from losing the value of the links you create on that page. This is important for search engine optimization (SEO) and the user experience of users who click on one of these links.

Redirect to Another Website URL
Redirect to Another Website URL

Knowing how to set up redirects is a valuable skill for anyone running a website. You can implement page-by-page or domain-wide redirection.

3 types of URL redirects

Most website owners should only use the first redirect, but there are three main types of redirects to be aware of.

1. 301 redirect

301 redirects are permanent redirects. This type of redirection is done at both the browser level and the server level. This is the most commonly used powerful redirect. Pass all SEO permissions for existing URLs. Search engines also recognize this type of redirect and index it, making it ideal for SEO.

In almost all cases, this is the type of redirect you want to use.

2. 302 redirect

The 302 redirect is a temporary redirect. Use only if you want to revert to the old URL at some point. For example, if you are redesigning your site but want to direct users to another domain during completion. Or if you want to A / B test two different versions of the page before committing to a new version.

302 redirects are rarely used. If you are using 302 redirects, carefully consider whether you can use 301 redirects.

3. Meta refresh

Have you ever visited a page and received the message “The original URL has been moved and redirected”? If you are not redirected within 5 seconds, click here “? Then you have experienced meta-realization.

A meta refresh is a redirect that works by telling the browser to go to a new page without updating the server. When setting up a meta refresh, you can specify how long it takes for a redirect to a new page to occur. Search engines can interpret meta refreshes the same way as 301 redirects, especially if the time limit is zero or one second. However, the way search engines read meta refreshes isn’t completely consistent and waiting for visitors to reach the page they’re looking for reduces the user experience.

If you’re considering a meta refresh, it’s best to use a 301 redirect.

How to Redirect to Another Website URL

Most website owners have several ways to set up redirects. Here are the steps for the three common options:

1. Set up redirects in cPanel

After logging into your cPanel account, scroll down to the Domains section. Find and click the redirect icon.

Set up redirects in cPanel
Set up redirects in cPanel

In the drop-down menu under Type, you can choose between permanent (301) and temporary (302). Please select.

From the drop-down menu below, select the domain you want to set up forwarding for. If you want to apply the update to all domains you own, you can select All public domains. Otherwise, select the correct domain from the drop-down list.

Then enter the page you want to redirect to and the page you want to go to. Note that the primary domain name is already specified in the drop-down menu, so enter only the last part of the URL in the first box. However, in the second box, enter the full URL of the redirect destination.

2. How to redirect to another page using jQuery?

Basically, jQuery is just a JavaScript framework, in this case you can use pure JavaScript to do things like redirects, so in this case you have three options for using vanilla JavaScript.

1) Use position replacement to replace the current page history. That is, you cannot use the back button to return to the original page.

window.location.replace ("https://codeexercise.com");

2) Use position assignments to keep history and use the Back button to return to the original page.

window.location.assign ("https://codeexercise.com");

3) It is recommended to use one of the methods above, but it may be the third option to use pure JavaScript.

window.location.href = "https://codeexercise.com";

You can also write and process the function in jQuery, but this is not recommended as it is a pure one line JavaScript function. You can also use all windowless functions above if you are already in window scope, such as window.location.Replace ("https://codeexercise.com"); It could be location.replace ("https://codeexercise.com");.

Also, I show them all in the photo below:

How to redirect to another page
How to redirect to another page

3. How to redirect to another page in HTML?

You can use the <meta> tag to redirect from one HTML page to another. This is a client-side redirect, where the browser asks the server to serve another page. It also uses the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value of the content attribute is the number of seconds before the page is redirected.

You can set it to 0 for immediate loading. Update tags are not displayed correctly in some browsers. The user can then view the message before the next page is loaded. Adding these quick links will not properly update some older browsers. In this case, you need to add an anchor link so that the user can follow the next page.

Syntax:

<meta http-equiv = "refresh" content = " time ; url = link"/>

Examples:

 <!DOCTYPE html> 
<html> 

<head> 
<title>HTML Redirect</title> 
<meta http-equiv="refresh"
content="5; url = https://codeexercise.com" /> 
</head> 

<body> 
<h1 style="text-align:center;color:green;"> 
Code Exercise
</h1> 

<p style="text-align:center;"> 
If your browser supports Refresh, 
you'll be redirected to CodeExercise 
Homepage, in 5 seconds. 
</p> 
</body> 
</html> 

4. How to redirect to another page in WordPress

The easiest way to set up a redirect in WordPress is to use a plugin. A common option for this is redirection.

If this is your first time adding a plugin to WordPress, select Plugins from the menu on the left side of the screen. Click Add New to search for the plug-in you need.

How to redirect to another page in WordPress
How to redirect to another page in WordPress

Click Install Now, then click Activate. Each plugin has its own instructions for using it. For redirects, find the redirect in the list of installed plugins, click Settings and follow the setup steps.

Once configured, you can find the redirects listed in Tools. Then click Redirect in the menu at the top of the screen and enter the information about the URL you want to redirect and the new URL you want to point to.

Also Read: Top 5 Best Programming Blogs to Improve Your Skills

Some reasons to create website redirects

There are three ways to set up redirects, but if you’re wondering why anyone cares, there are a few main scenarios where this can happen.

1. Redirect multiple domains to a single domain

Many brands buy multiple domain names linked to their main URL to protect their brand online. The brand is Acme Corp. In case of, it is recommended that you own acme.com, acmecorp.com, acme.net, etc.

Instead of buying a domain to prevent others from registering and leaving the domain, you can redirect to the main website. Whether it’s a common misspelling of an existing domain name, another top-level domain name extension, or something else, it’s worth redirecting to the primary site.

2. Redirect the old URL to the new URL

You may need to change the URL of an existing page or post. You may have cleaned up an existing URL structure or you may have moved some pages so that the old URL doesn’t make sense.

In this case, you need to implement a 301 redirect from the old URL to the new URL. This is especially true if old articles are already indexed by search engines or if there are links pointing to them somewhere online.

2. Redirect the duplicate content to the original page

Having duplicate content on your site is bad for SEO. For large sites, there may be pages with duplicate content. If you have multiple versions of the same page, it is difficult for Google to determine which pages to rank.

Avoid duplicate content issues by redirecting duplicate content to original content. This reduces visitor confusion and improves search engine rankings.

4. Redirect the old domain to the new domain

Have you successfully created your site with a domain that wasn’t your first choice and then bought your dream domain? Or you may need to change your domain name after a major branding change.

Whatever the reason, you need to implement a redirect from your old domain to your new domain. Currently, site-wide migrations are more targeted than simple redirects, but that’s an important part of the process.

5. Redirect subdirectories to pages on your site

When you created your site, you may have decided to create your blog page on a subdomain of your site. So instead of setting the blog URL to “mysite.com/blog”, I created it as “blog.monsite.com”. And now you have decided that it makes sense to remove your blog from the original subdomain structure.

This is when you set up a redirect. The same is true for other reasons where you want to create a site or section of a site in a subdomain and change the URL structure to a new one.

Source:
https://www.hostgator.com/blog/ways-redirect-website-url/
https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage

Leave a Reply