WordPress

How to redirect a page to another page in WordPress?

This brief tutorial explains how to redirect a WordPress page to another one through different simple methods.

After reading this tutorial, you will know how to edit the .htaccess file in your hosting to redirect traffic from one URL to another and install a plugin to do the same from the dashboard.

All instructions explained in this tutorial include screenshots to make it easy for WordPress beginners to follow them.

How to redirect a WordPress page from the dashboard:

This tutorial section shows how to redirect a WordPress page from the dashboard without manually editing the .htaccess file (An alternative method explained here).

To redirect WordPress URLs from the dashboard, you need to install a plugin. For this tutorial, I selected a plugin named Redirection. To install it on the left menu, select Plugins, and on the displayed submenu, press Add New as shown in the screenshot below (Plugins>Add New).

On the next screen, on the keyword search field, type “redirection,” as shown in the following image. Then press the Install Now button on the Redirection plugin (See the arrows below).

Once the Redirection plugin is installed, press the Activate button.

After the installation ends, you can find the plugin on the left menu, under Tools, as shown in the image below (Tools>Redirection).

The first screen of the plugin will show two fields to set a source page and target page for redirection. If you have only a page to redirect, you can type it now and press the Start Setup; you can ignore this and press the Start Setup button if you have many.

The Basic Setup page allows you to configure automatic updates for URLs/Permalinks changes. This is an excellent option to prevent errors; I recommend selecting it.

You also can instruct the plugin to keep a log of 404 errors. Make your choice and press the Continue Setup button.

The last configuration screen will connect the plugin to an API automatically. If the connection is successful, you will see the Good status shown in the image below. Then press the Finish Setup button.

Wait for the configuration to apply changes and press the Finished! Button.

Now you can define the WordPress pages to be redirected.

To add redirections, fill the Source URL and Target URL fields.

Next to the Add Redirect button, you will see a gear icon, press it to display advanced options such as 301 and 302 redirections, among others.

Once the source and destination addresses as http code were defined, you can press the Add Redirect button to apply changes.

How to redirect a WordPress page to another from Cpanel:

Follow the instructions below if you prefer to redirect sites by editing the .htaccess through the Cpanel account.

If using Cpanel, find the File Manager shown in the screenshot below. You can use the search field to type File and find it fast.

Once in the File Manager, let’s make sure hidden files are visible. Press the Settings button in the right upper corner, as shown below.

Ensure the option “Show Hidden Files (dot files)” is selected and press the Save button.

Find the file named .htaccess, right-click and press the Edit button.

When asked to confirm the encoding, press the Edit button.

Within the .htaccess file, you need to include redirection rules based on the following available types:

Redirecting a page to another page in WordPress (.htaccess):

To permanently redirect an old URL to a new one, you can use the syntax below. Add the line below, replacing page.php and newpage.html with your actual page paths. You can use HTML, PHP files, or directories. This syntax is used to redirect pages within the same domain.

Note: It is recommended to keep a backup of your original .htaccess file if you need to restore the previous configuration.

Redirect 301 /page.php /newpage.html

The example below shows how to implement a temporary redirection. The syntax is the same as permanent; the only difference is that the HTTP code changes from 301 to 302. Use 301 for permanent redirection and 302 for temporary redirection.

Redirect 302 /page.php /newpage.html

Permanently redirect your WordPress site to a new domain:

To permanently migrate your domain name, the syntax is the following. Just replace http://domain.com/ with your actual domain name and remember to implement https if available (Below, you can find a rule to redirect all traffic through https on the new destination domain).

Redirect 301 / http://domain.com/

To redirect a specific subfolder or page to a new domain, you also can use the syntax below.

Redirect 301 "/home" "https://otherdomain.com/home"

Temporary redirection of your WordPress site to a new domain:

To temporarily redirect your site to a new domain, the syntax is the same as above; just replace 301 with 302 as shown below.

Redirect 302 / http://domain.com/

You also can redirect subfolders to a new domain; as shown below, you can implement quotation marks.

Redirect 301 "/home" "https://otherdomain.com/home"

Redirect all traffic through https (SSL) from the .htaccess file:

To redirect your WordPress site traffic through SSL (https), add the following code to your .htaccess file.

Note: If you already have code within your .htaccess file, you can skip the line RewriteEngine On.

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You also can use the code below to redirect your http www website to https without www.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.example.com

RewriteRule (.*) https://example.com/$1 [R=301,L]

All changes made on your .htaccess are automatically applied.

How to redirect a WordPress page to another from FTP:

If you access your WordPress files through FTP, read the instructions below.

In the example below, I’m using the FTP client Filezilla; you can use anyone you want.
Fill in your username and password and connect to your server. Then find the .htaccess file as shown below and download it. If the .htaccess file isn’t there, don’t worry, you can create and upload it as described in the following steps.

Once you have downloaded your .htaccess file, make a copy (Backup) and open it. If .htaccess wasn’t on your server, open a notepad file and name it as .htaccess. Then follow the redirection instructions described here depending on your needs, and upload your file back to your server. Once uploaded, you can test the changes you added by accessing your WordPress site.

Conclusion:

As you can see, redirecting a page to another page in WordPress is pretty easy and can be achieved differently. Any WordPress-level user can apply this simple process by following instructions as described above. The .htaccess way is helpful for all websites, not only WordPress ones. Keep in mind the Cpanel and FTP methods are almost the same, changing only the method to connect your server. Remember always to keep a backup of your original .htaccess file if you need to restore the previous configuration.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.