Redirect a WordPress page without a plugin
parallax background

Redirect a WordPress page without a plugin

Website Navigation Design: How to Make it User-Friendly
October 8, 2023
Great looking technology websites you should check out
October 10, 2023
Website Navigation Design: How to Make it User-Friendly
October 8, 2023
Great looking technology websites you should check out
October 10, 2023

URL Redirection is a mechanism for redirecting site visitors from one domain or page to another. It is possible to redirect your visitors to any web page on the internet, but it is most commonly used to reroute them within the same website. When a user enters a URL or clicks a link to Page A, you may redirect them to Page B instead.

It is not optimal to set up redirects. It slows down the user's experience since the browser will go to the first URL, receive the redirect message, and then proceed to the second URL. And there's a chance you'll set up the redirect incorrectly or just forget to do it after altering a URL. Unfortunately, Google missed the notice and continues to direct users to your non-existent page. What are we going to do about it? The ideal option is to utilize a 301 redirect to transfer people to another page that contains the information they need. If it doesn't already exist, make it! By receiving clicks in the SERPS, the page is obviously doing something well. You must capitalize on it.

In most cases, this entails installing a plugin in WordPress to redirect a page. While this is not a bad idea, it is overkill if you only want to redirect one or two pages. Using a code inserter or the functions file in your themes directory. Configure your permalink settings to utilize beautiful permalinks when you initially set up your site and before you add any articles or pages to minimize altering URLs.

In this article, we will explain to you how to redirect a WordPress page without a plugin.

Methods of Redirecting WordPress without a plugin:

Creating a WordPress Redirect Using .htaccess


One of the first things you have to know about when learning how to redirect a WordPress page without a plugin is about the .htaccess file.

The .htaccess file is one of the most crucial files on a website. Because HT stands for hypertext access, it stands to reason that you may use it to accept, reject, or divert access to your site. While it may appear scary due to how critical it is that you do not make any mistakes, the actual altering of the file to redirect is as easy as it can be.

To access the root directory of your WordPress installation, use your preferred FTP software. .htaccess should be found just beneath the main directories. Open this with a text or code editor of your choice. To create a WordPress redirect, just add a line of code right above the line that reads # BEGIN WordPress.


Either of these lines of code will route your whole website to the chosen URL. If you wish to redirect a certain page, post, or URL on your site, you must give both the source and destination URLs. Both can be the relative path (assuming you stay inside the same domain) and are separated by a single space.

Setting up wildcard redirects


When you wish to redirect a group of URLs that share specific elements, use a wildcard redirect. This is also important when wanting to redirect a WordPress page without a plugin. For example, if you alter your permalink structure, a wildcard redirect will redirect everyone who uses a link from your old structure to the identical link in your new structure.

If you change your post permalink structure from /blog/post-name to /category/post-name, for example, you'll need to employ a wildcard redirect to guarantee that anybody using the old links gets diverted to the new URL. Wildcard redirects make advantage of a feature known as Regex, which allows you to build sophisticated redirects. To set up a wildcard WordPress redirect, you must first activate Regex functionalities.

Scroll to the Add new redirection area of the screen by going to Tools > Redirection. Enter the old route to categories as a wildcard in the Source URL box. It must be in the format /oldslug/(.*)$. The Target URL entry must include the source /newslug/$1. Then select the Add Redirect option.

Setting up manual redirects


Often the WordPress redirect plugin will miss the page redirect you require. Perhaps you want to redirect one article on your WordPress site to another, or you want to redirect a URL on your domain to a different website. This is why it is useful to learn how to redirect a WordPress page without a plugin.

In this instance, you'll need to set up a manual redirect in WordPress without the use of a plugin. Scroll down to the Add new redirection area under Tools > Redirection.

Type or paste the URL you wish to redirect from into the Source URL area. Enter or paste the URL you wish to redirect to in the Target URL area. If you're redirecting from an older post to a later one, leave the Group option as Redirections (the default) or choose Modified posts. This will provide browsers with information about the kind of reroute. When you press the Add Redirect button, your custom redirect will be added to the list of redirects.

Through cPanel


This solution is ideal if you do not want to utilize a plugin to redirect URLs and use cPanel hosting. The procedure is really straightforward. Navigate to your hosting account's cPanel and choose "Domains" > "Redirects." You should see a screen similar to this one, with various options to pick from. You must pick the type of redirection you wish to do in the "Type" selection box, whether permanent (301) or temporary (302). (302). It should be simple to pick between the two choices depending on the link you want to redirect to.


Select your domain + current page address from the second dropdown menu. After that, in the last field, write the web page address, which should replace your existing page address. You're done when you click "Add."

Cloudflare rules


If your website uses Cloudflare, you may also do the redirection from there. Simply log in and follow the simple procedures outlined below:

Click on the domain to which you want to redirect links from the homepage. Click on one of the top tabs labeled "Page Rules." Select the “Create Page Rule” option.

This dialog will appear. Fill up the first field with your chosen URL. Then, under the settings, select “Forwarding URL” and either 301 or 302 redirect as needed. Finally, type in your target URL. Once everything is filled out, click "Save and Deploy" to finish the task.

Edit Your WordPress functions.php File to Create a Redirect


Firstly, add the redirect code function, and then this code checks if the user is on the about page, and if they are, they are routed to the home page.

You may alter this to check for any other page by changing the ‘about' string, which checks if the user is on the about page. For instance, we may change the code to check if the user is on the contact page.

Types of redirects - examples:

  • 301 - This is a permanent redirect that signals that the initial page is no longer in existence.
  • 302 - in its original location This is the ideal redirect to employ if you want to keep your search rankings respectable.
  • 303 - When the requested file exists at the provided location but cannot be discovered for whatever reason, this redirect offers an alternate page. This is a temporary redirect that created issues with some browsers, therefore most site administrators no longer use it.
  • 304 - Designed to take the place of the less-than-helpful.
  • 308 - This sort of redirect, like the 303 and 307 redirects, performs the same goal. It is, however, permanent rather than transitory. It is more beneficial for programmers than for regular WordPress users.

FAQ on redirecting a WordPress page without a plugin

Why would someone want to redirect a WordPress page without a plugin?

Well, you see, sometimes folks just want to keep their WordPress site lightweight. Plugins can slow things down, and not everyone's a fan of that. Plus, there's always that tiny risk of a plugin conflicting with another. So, going the manual route can feel a bit more in control, you know?

How can I manually set up a redirect in WordPress?

Ah, the age-old question! Dive into your site's .htaccess file. It's like the backstage pass to your website's redirection concert. Add a line like Redirect 301 /oldpage.html /newpage.html and voila! You've got yourself a redirect. But, always backup before you tinker. Safety first!

What's the difference between a 301 and 302 redirect?

Great question! So, a 301 redirect is like telling the world, "Hey, I've moved permanently. Update your address books!" On the other hand, a 302 redirect is more of a temporary thing. It's like saying, "I'm just here for a short visit." Search engines treat them differently, so choose wisely.

Can I redirect a page to an external website?

Absolutely! When you're setting up that redirect in your .htaccess, just point it to the external URL. Like, Redirect 301 /mypage.html It's like giving your visitors a friendly nudge to another place on the web.

What if I mess up my .htaccess file?

Oh man, been there, done that! If you goof up your .htaccess, your site might go down. But don’t freak out! Just revert to the backup you (hopefully) made before messing around. If you didn't make a backup (tsk tsk), remove the changes, save, and breathe. It'll be okay.

Are there other ways to redirect without touching .htaccess?

You betcha! You can use PHP for this. Drop a little snippet at the top of your WordPress template: <?php header("Location:"); exit(); ?>. But remember, this method has its quirks. It's like taking a detour instead of the main road.

How do I know if my redirect is working?

Test it out! Type in the old URL and see if it takes you to the new spot. If it does, give yourself a pat on the back. If not, double-check your work. Sometimes it's just a tiny typo causing all the drama.

Can redirects impact my SEO?

For sure! Redirects, especially the 301 ones, pass on the link juice. It's like handing over the SEO torch to the new page. But, if done wrong, it can confuse search engines. So, always ensure you're redirecting for the right reasons and in the right way.

What about redirect loops? How do I avoid them?

Ah, the dreaded redirect loop! It's when Page A redirects to Page B, which then redirects back to Page A. It's like a dog chasing its tail. To avoid this, always double-check your redirects and ensure there's a clear path from start to finish.

Can I set up conditional redirects?

Oh, getting fancy, huh? Yes, you can! With a bit of PHP magic, you can set conditions like redirecting only if a user is logged in, or if they're from a certain country. It's like setting up a VIP entrance to your site. But, tread carefully, and test thoroughly.

Ending thoughts on redirecting a WordPress page without a plugin

You'll need to set up a redirect if you alter the URLs on your WordPress site or publish a new post to replace an old one. You may use an automated redirect, a manual redirect, or a wildcard redirect depending on the modifications you've made. I hope you learned how to set redirects for various situations from this post.

If you enjoyed reading this article on redirect a WordPress page without a plugin, you should check out this one about WordPress briefly unavailable for scheduled maintenance error.

We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, Wordpress mixed content errors, how to reorder pages in WordPress and WordPress updating failed error.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 260,000+ customers.
Siteground Hosting