How to Automatically Replace Keywords and URLs Using Pretty Links

As your site grows larger, so too will the number of links it contains. If you ever need to make sweeping changes to multiple links at once, such as by updating their destinations or keywords, the process can be time-consuming.

To save you time and effort, Pretty Links offers a Replacements feature. This enables you to automatically replace keywords and URLs. Not only will this make it easier to maintain your links, but you can also automatically add links to certain keywords all across your entire site.

In this article, we’ll talk more about when you might want to use this feature, and how it can be helpful. Then we’ll demonstrate how to enable these replacements using Pretty Links. Let’s get started!

An Introduction to the Keyword and URL Replacements Feature

The Pretty Links plugin offers many useful features for managing your links. While you can (and should) use this plugin to generate shortened links for your pages, it has many additional options that give you complete control over every link on your site. One of the most powerful of these is the Replacements functionality.

This feature is essentially two tools in one. First, it enables you to replace all links on your site with automatically-generated shortened links, which we call ‘pretty links'. What's more, you can also use the replacements feature to automatically add links to certain keywords.

There are several ways this feature can help you manage your links more effectively. For example, you can use keyword and URL replacements to:

  • Replace all your links with shortened pretty links. As we mentioned, this is the feature's primary purpose. Replacing your links this way enables you to track their performance.
  • Automatically link keywords to a specific URL. This enables you to choose a keyword, and have all mentions of it across your site link to the same page.
  • Apply formatting, styling, and settings to all links. Replacements enables you to update the settings for your links in one place.
  • Link to a disclosure of affiliate links. If you run an affiliate marketing site, replacements can help you generate a link to your disclosure statement on every page where such links appear.

As you can see, there are plenty of reasons to use the replacements feature. Next up, we're going to look at how you can get started.

How to Automatically Replace Keywords and URLs Using Pretty Links

To start replacing your keywords and URLs, you'll first need to install Pretty Links. Then, you'll want to navigate to Pretty Links > Options. There you'll see a tab labeled Replacements, which you can click to open all settings related to replacing links:

The Keyword & URL Auto Replacements Options in Pretty Links.

Select the Enable Replacements option to activate the feature. This will expand the page, to show you all the available settings:

Viewing the full replacements options after activating the feature.

Depending on what you want to use the tool for, the options you need to set will differ. Let's go through both of the primary applications.

Replace All URLs With Pretty Links

To replace all URLs on your site with shortened pretty links, you'll simply need to check the Replace All URLs option:

The Replace All URLs option activated.

When this setting is active, the plugin will create a pretty link for each URL it finds on your site, and replace every link accordingly. You can also enter domains that you do not want to replace in the Domain Blacklist field.

It's worth noting that you should avoid using this if you have a very large number of links on your site, as that can cause performance issues. If you want to reverse this process, you can deselect the option. This will return all links to their original state, but the shortened links will still be available in your pretty links list so you can use them later on.

There are a few additional options in the same section, which you can use if you want this process to run in your comments and RSS feeds as well. Bear in mind that using replacements in RSS feeds may cause them to slow down.

Finally, if your site uses wp-cron, you can also select Index Replacements to create an index of all your replacements. This can help to significantly improve performance, but is only recommended if you're an experienced developer.

Automatically Add Links to Specific Keywords

Once you've enabled replacements, you'll need to specify which keywords you want to use with each pretty link. To do this, navigate to Pretty Links > Pretty Links:

Viewing your existing pretty links.

Find a pretty link you want to attach a keyword to, and click Edit. On the Edit Link page, open up the Pro Options, where you'll find the Keywords field:

The Pro Options for a pretty link.

Here you can enter all keywords you want to link to this URL. For example, if the link points to a Support page, you might simply want to use the keyword “support”. When you save the link, every instance of that word or phrase on your site will now be linked to the same page:

An excerpt from a blog post with every instance of the word "support" turned into a link.

However, it's a good idea to limit the number of keyword replacements you use. Too many can lead to ‘over-optimization', which can actually hurt your search rankings. You can do this by returning to the Replacements options and using the Thresholds setting:

The Thresholds settings in the Replacements options.

Here you can choose the maximum number of replacements and keywords that will appear on each page. This will randomly select instances of each keyword to replace, so you'll avoid over-optimizing them:

The same blog post excerpt, with only one instance of "support" replaced with a link.

If you want to further customize your keyword replacements, you can use the options to Open in New Window and Add No Follow, or specify Custom CSS to alter the links' appearance.


By using the automatic keyword and URL replacement feature, you can quickly apply sweeping updates to all the links on your site. You can also use it to automatically add links to specific keywords, which can improve your search rankings and direct visitors to key pages.

In this article, we’ve covered how you can use Pretty Links and its powerful Replacements feature to do both of these things. You're now ready to replace your existing links with shortened pretty links, and apply links automatically to whatever keywords you like.

Do you have any questions about replacing URLs and keywords using Pretty Links? Let us know in the comments section below!

Affiliate Link Disclosure

Categories: Pretty Links
About John Hughes

John is a blogging addict, WordPress fanatic, and staff writer.



    Sven Mund

    August 23, 2023

    How can I use prettylinks to cloak an url from "my" to "another" while loading the content from "load"?