December 13, 2019 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.

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 a Filthy Office can Affect Your Productivity at Work?

October 7, 2019

October 7, 2019

There are simple things in your office space that have an effect on your overall work quality. These factors would...

Six Things to Consider Before Completely Going Vegan

February 25, 2019

February 25, 2019

Many people discover that going vegan turns out to be quite frustrating. Thankfully, there are things that we could do...

How to Maintain the Performance of Your Brain?

February 7, 2019

February 7, 2019

You can be productive and have proper lifestyle if you have well functioning brain. If you want to live well,...

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...

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...

Choosing An AV Company For a Larger Event? Here Is What You Should know!

September 2, 2019

September 2, 2019

Poor AV performance at a critical event can bring in devastating outcome upon your reputation. The venue and lightning all...

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...

The Best Footballers from Ghana

August 14, 2019

August 14, 2019

The Ghanaian football team is one of the most celebrated African sides in recent history. Football being the most popular...

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...

How Gamers Can Prevent Addiction?

February 12, 2019

February 12, 2019

Any avid gamer knows that when it’s time to play, then need to do it immediately without delay. The desire...

Understanding How Youth Offending Teams Work

June 24, 2019

June 24, 2019

When you are discussing youth offending jobs, a lot of the time, you are mostly thinking about a role such...

6 Preventive Measures Businesses Can Do to Prevent Money Laundering

November 8, 2019

November 8, 2019

Money laundering is illegal and a heinous crime that has become rampant. Thus, it gives long term problems for you...

Top Features that Help Your Dating App Succeed

April 9, 2019

April 9, 2019

When you make your mind to build a dating app, you better be prepared to confront existing market leaders, like,...

How Busy Professionals Can Lose Weight

February 15, 2019

February 15, 2019

Busy professionals often don’t have the proper eating habit and they could be inclined to just grab anything available in...

Comments
Leave a Reply