HTML, PHP, JavaScript, WordPress, Apache, and Nginx Redirect Generator

Our comprehensive Apache and Nginx redirect generator will empower you to redirect a massive number of URLs in one simple click. This is a wonderful approach to redirecting bulk URLs in a flash.

OLD URL NEW URL

How to Use the 301 Redirect Generator

The following steps explain how you can use the app to redirect a webpage:

~ Step 1 ~

Insert the URL for your old/original webpage you aim to redirect.

~ Step 2 ~

Insert the new URL, which is where the user is redirected by clicking on the old/original URL.

~ Step 3 ~

Click on Generate 301 Redirect Code, copy the generated code, and add it to your configuration files.
301 redirect generator

What are Page Redirects?

All webpages on the Internet have a unique URL, which is short for Uniform Resource Locator. In cases where content shifts from one URL to another, redirects are necessary. In fact, the redirect forces the browser to automatically switch from the original URL to the new one.

It should be noted that redirects can point to any other URL, whether from the same website or a new one. Redirects to new domains/websites are widely known as cross-domain redirects.

Temporary vs. Permanent Redirects

301 redirects are permanent, and 302 redirects are temporary.

When you need to permanently change the location of a webpage, 301 redirects are the solution. 302 redirects, on the other hand, are used when you plan to move the page back under the original URL later. Generally, you need to use 301 redirects for your website most of the time.

What are Nginx and Apache?

Nginx and Apache are two widespread web server software that allow users to deploy their websites on the Internet. A web server is a piece of software managed by your hosting provider so visitors can view your website pages.

One big advantage of Nginx and Apache is that they can manage heavy traffic with minimal configuration. They can be deployed on various operating systems, including MacOS, Linux, and Windows. You can use them to add encryption security protocol (SSL) or Server Side Programming Support (PHP) on the server.

What are .htaccess and .conf Files?

These two files help you alter your website configurations on a per-directory basis. They can be used for various purposes, including:

  • Loading customized error pages such as the 404 page
  • Creating URL redirects
  • Performing password-protected authentication for distinct directories on your server

Nginx Redirect

You can use the built-in rewrite directive to manage most of your redirects in Nginx. The tool is readily available once you install Nginx and can create both temporary and permanent redirects with ease.

How to Redirect Pages in Ngnix?

1. Add the redirect code from the Nginx redirect generator to the .conf file, which is usually found in the document root directory of your website: /etc/nginx/sites-available/directory_name.conf.

2. Edit the .conf file, test the configuration, and restart Ngnix. You can use PUTTY for this purpose, which is an open-source terminal emulator and network file transfer application.

2.1 Syntax check: nginx –t

2.2 Restart Nginx: service nginx reload

Apache Redirect

If you’re permitted to change the httpd.conf file, it’s suggested that you add the redirect directive from this file instead of the .htaccess file.

Htaccess / WordPress Redirect

The .htaccess file is generated in a certain directory comprising one or more configuration directives that are applied to that directory and its subdirectories. In shared hosting, you need to use this file to change your server configurations.

PHP Redirect

In PHP, you can use the PHP header() function to simply redirect to a new page. The code in the following example redirects you from the page in the URL:

<?php header("Location: http://www.example.com/another-page.php"); exit();?>

JavaScript Redirect

The redirecting technique in JavaScript moves the search engines and users toward a different URL instead of the original one. You can use a myriad of redirecting techniques in the JS, but the most popular ones are location.href and location.replace().

window.location.replace("new URL")

HTML Redirect

The easiest method to redirect a URL to another one is via an HTML tag with the http-equiv parameter set to “refresh”. The content attribute defines the delay before the browser redirects the user to the new URL.

<meta http-equiv="Refresh" content="0; url='https://www.w3docs.com'" />

Share This 301 Redirect Generator

Thank you!