May 8, 2021 Blogja.net

URL Redirection: 5 Effective Ways to Redirect a Website URL

There will be times when you will have to change your website address or move an old content to another section on your site (i.e. from blog post to resources). However, that does not mean that you need to re-build your site traffic and link authority from the ground up.

That’s because there is this thing called URL Redirection or URL Forwarding.

Good thing, you can simply install a plugin to implement a 301 redirect for WordPress sites. Meanwhile, there are different ways on how you can implement URL redirection on your website:

Ways to Redirect Your Webpage

You may have noticed that when you visit some websites, they will change their URL midway through the loading process. This is where URL forwarding occurs.

So, how do websites do it? Keep on reading to find out:

1. HTML redirects

HTML redirect is perhaps the simplest way to do a URL redirection. Moreover, it is a client-side redirection, wherein the redirect tag tells the browser to request a new page.

All you need to do is place a Meta Refresh tag within the <head> at the top of any HTML page. Your code should look something like this:

<meta http-equiv=”refresh” content=”0; URL=’https://newcompanywebsite.com’”/>

The “content” attribute determines the time of delay before the browser redirects the user to a new domain. So, in this case, it is set to 0 seconds.

Although this is the simplest way to implement a URL forwarding, it comes with a few hiccups.

  • Some browsers freak out whenever it loads a web page with a Meta Refresh tag.
  • Site visitors might see a flash as the old page loads before being redirected to the new one.
  • HTML redirects disable the Back button on old browsers.

No wonder a lot of web developers discourage to use HTML redirects as a solution.

2. JavaScript redirects

If you are wary to use HTML redirects, you safe bet would be to do a JavaScript redirect. It is pretty easy to do.

In fact, all you need is to change the “location” property on the “window” object:

window.location = “https://newcompanywebsite.com”;

There are also other ways to do it:

window.location.href = “https://newcompanywebsite.com”;

window.location.assign(“https://newcompanywebsite.com”);

window.location.replace(“https://newcompanywebsite.com”);

Aside from that, you can also do a couple of neat stuff with the “location” object. This includes reloading the page and changing the origin and path of a URL.

However, it comes with some caveats:

  1. A user must enable, download, and run JavaScript in order for it to work.
  2. You cannot relay redirect information since it does not have a status code.
  3. It is not clear how search engines react to this.

Thus, although JavaScript redirect is a safe option, it can interrupt your site visitor’s user experience. Not to mention that we do not know its impact on your website’s search engine optimization efforts.

That said, you will need a server-side solution that can help with sending 301 responses to search engine bots and internet browsers.

3. Apache redirects

Apache redirect is the most common way of URL redirection. What you need to do is add a specific rule to a .htaccess on your Apache web server. And then let the web server do the heavy lifting for you.

In case you are unaware, a .htaccess is a document that allows you to give commands to Apache. On the other hand, Apache is a software that runs on your server.

Thus, you can create a new .htaccess file or edit an existing one in order to implement URL redirection. The URL forwarding rule that you will add should be like this:

Redirect 301 / https://newcompanywebsite.com

After that, you will add the file to the root directory of your old website. That way, a site visitor that will land on any page on your old website will be redirected to the new one.

However, the mentioned rule will only work on Linux servers, provided that the “mod_rewrite” is enabled. It is a module that allows you to redirect requested URLs on the server.

Most hosting companies have the “mod_rewrite” module enabled. Otherwise, you can contact your web host provider for more information.

4. Nginx redirects

If you are on an Nginx server, you can handle URL redirects by adding a server block in the nginx.conf file.

It is something like this:

server {

listen 80;

server_name oldcompanywebsite.com;

return 301 $scheme://newcompanywebsite.com$request_uri;

}

There are a handful of best practices regarding Nginx. So, it is always a good idea to review and take a closer look at it before you tweak anything.

5. PHP redirects

A PHP redirect is quite straightforward, as you can set the URL redirect rule on the header function. However, this tactic comes with two issues:

  1. You need to set the rule before any markup or content
  2. The function sends a 302 redirect by default

What you need to achieve is a 301 permanent redirect. Thus, the PHP redirect rule should be:

<?php 

header(‘Location: https://newcompanywebsite.com’, true, 301);

Exit;

?>

Adding the “true” parameter will help you replace the response code to 301.

Conclusion

There are various reasons you will need to implement a URL redirection on your website. Not to mention that there are basic ways to do that, including the use of a URL shortener.

This is not just to redirect your site visitors to the right page, but doing so can also help maximize your domain authority. The same thing goes if you want to maintain your search authority and link equity.

Do you know other tricks to redirect an old URL to a new one? Let us know in the comments!

Related Posts

Smart Buying Tips for Shopping from eCommerce Platforms

November 24, 2019

November 24, 2019

The world of today has shrunk into a global village and the significance of time has dignified to a higher...

How Busy People Can Train Their Dogs

February 6, 2019

February 6, 2019

For many of us, dogs are part of our lifestyle and they are simply part of our family members. However,...

Importance of trees within the society

January 24, 2020

January 24, 2020

Trees were there before us on this planet we call home. They are an integral part of the earth’s very...

Sacred Sites: The 10 Oldest Churches in the U.S.

August 18, 2020

August 18, 2020

The wonder associated with churches and other religious sites spans generations and personal interests. From symbols of spiritual significance along...

How Can You Design a Secure Website For Your Small Business

June 10, 2019

June 10, 2019

Many elements add up to an excellent site design other than being aesthetically pleasing. Functionality, easy navigation, and excellent user...

Small Business Phone Systems for Startups

April 6, 2020

April 6, 2020

Building a startup out of the earth up or keeping your company afloat in a very competitive economy is a...

Why MBA is Preferred After Engineering?

April 9, 2019

April 9, 2019

Most of the student after their engineering program completion opts for MBA. This is not the case with of course...

Smart Ways to Pack for a Week in Your Carry-on

September 11, 2019

September 11, 2019 1

Every traveler knows that excess baggage comes with a fee. And no one wants to spend money on that. After...

Larger Than Life: The Most Important Exhibition You Missed This Year

September 2, 2019

September 2, 2019

Zurab Tsereteli is the most successful artist you’ve never heard of, and this year Britain had the chance to explore...

Lifestyle Adjustments From Pregnant Women

February 21, 2019

February 21, 2019

Pregnancy is a big physical change, so your lifestyle inevitably needs to change as well. There are things that you...

7 Fastest Cars with their Features and Protection Tips

April 7, 2020

April 7, 2020

“The Fastest car” means more than max speed in my term. A supercar that is complete has to have a...

A Simple Guide for Facebook Ad Re-targeting in 2020

April 6, 2020

April 6, 2020

What is Facebook Remarketing or Retargeting? Facebook nourishes your ad appears to remind them what they are overlooking. Describes remarketing...

Champion Standby Generator: Low Cost & Technologically Advanced

September 25, 2020

September 25, 2020

Generators are no more a luxury these days they are a necessity. The homeowners are always looking for better value...

How much does it cost to replace cast iron pipes?

October 18, 2019

October 18, 2019

  During the 1930s and 1940s, iron cast pipes were used in the construction of houses. By nature, they have...

How to Take Your Pet to The Vet

March 22, 2021

March 22, 2021

Having a sick pet is never fun, but having to take it to the vet adds to the stress, however...

Comments
Leave a Reply

Your email address will not be published. Required fields are marked *