How To Redirect HTML Web Page Into Another URL? – POFTUT

How To Redirect HTML Web Page Into Another URL?

HTML is a language used to build web pages. Web pages have a dynamic nature where it can change during time. One of the most popular change cases is redirecting given web page to another web page. This is simply called we page redirect. In this tutorial, we will examine the redirect process in different ways, languages, and technologies.

HTML Redirect

The most popular and basic for web page redirect is using HTML. HTML has two main parts named <head> and <body> . We can provide some special tags into <head> in order to redirect HTML page. We will use <meta> tag with detailed attributes. In this example, we will redirect to . We will use http-equiv attribute with refresh value.

JavaScript Redirect

JavaScript is client-side technology which can make dynamic changes after or during HTML page load. JavaScript language provides window.location object which is used to get and set current page URL.

OR JavaScript provides different mechanisms to change or redirect HTML web page.

Apache Redirect

Apache is a popular web server. We can redirect a page by using Apache on the server side. We can use Redirect or RedirectMatch directives to redirect web pages completely or specifically.

We can redirect pages starting with /blog

Or we can redirect specific web page like page.html in the following example.

LEARN MORE  What Is Apache Web Server?

Nginx Redirect

Nginx is another popular web server used to serve web pages. It can redirect web pages using return directive. This can be also used to redirect http web pages to the https versions.

Lighttpd Redirect

Lighttpd is a web server used to server light we sites. We can use  mode_redirect module and its url.redirect function to redirect HTML web pages. In this example, we will redirect into .

PHP Redirect

PHP provides the HTML redirect features with header() function. Actually header() function will insert HTML meta tag into the HTTP response. header() usage is very simple where we just provide the Location: with the URL we want to redirect.

Ruby on Rails Redirect

Ruby on Rails provides ApplicationController class which can be used inherit into our class. We can use index function and put redirect_to function for redirection.

.Net Redirect

.Net provides languages like C# and Visual Basic. We can use Reponse class and its functions Redirect() and attributes Status , AddHeader.


LEARN MORE  Wget Command Tutorial With Examples For Linux and Windows


Node.js Redirect

Node.js provides writeHead() function with http library. We can redirect into http with the following code.

Flask Redirect

Flask is a python framework which uses app.route() and provides redirect() .

Golang Redirect

Golang provides net/http library which provides http.HandleFunc() to handle HTTP response and using Redirect() function to write the new redirect URL.

1 Response

  1. error code 0xc00000f says:

    There is two type of redirections which are 301 and 302. Generally, 301 redirections are used in case of any 404 error we use the 301 redirections. It can be done by changes in the header files. It can be also done with simple plugins.

Leave a Reply

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

Enjoy this blog? Please spread the word :)