If you’ve removed the base from your permalink structure, then you must consider redirecting your old URLs to the new URLs so that you can ensure you don’t lose any search engine traffic due to these broken links.
Removing a Particular Word from the URL
In this knowledgebase article, we’ll walk you through how you can remove a particular word from all your URLs. This can be handled easily in Rank Math by setting up redirections in the Redirection Manager.
1 Navigate to Redirections
At first, head over to WordPress Dashboard > Rank Math > Redirections, as shown in the image below. If the Redirections Manager is not available in your Rank Math menu, make sure that you’ve enabled the Redirections module from Rank Math > Dashboard > Modules inside your WordPress admin area.
2 Add a New Redirection
In the Redirections Manager, click the Add New button as shown below.
3 Create a Regex Redirection
To remove a particular word from all our URLs, we need to create a redirection with the regex (regular expression) matching type.
What we will do is that we will instruct Rank Math to look for a specific word in the URL with a regex. And when the URL with specific word matches our regex, Rank Math would remove the word from the URL and return the URL’s remaining part. The resulting URL would be the destination URL or the URL where your visitor would be redirected to when they land on your old links.
The regex for removing a word would be:
Regex Source URL: ^wordtoreplace/(.*) Destination URL: /$1
In the Regex Source URL, you’ll need to replace
wordtoreplace with the word, you wanted to remove from the URL.
Now in the Add Redirections dialog box, add your source and destination URLs and select the matching type as Regex from the drop-down list. This is how the redirect will look inside the dialog box.
Once you’ve added the Source URL, Regex matching type, and Destination URL, set the status to Activate and click the Add Redirection button.
Now that the redirection is activated, for instance, a visitor landing on your website’s page
https://www.example.com/wordtoreplace/post-url/ would be redirected to
https://www.example.com/post-url/ with a 301 redirection.
And, that’s it! We hope you were able to remove a particular word from the URL with this tutorial. If you still have any questions on using our Redirection feature, feel free to reach our support team — as we’re always here to help.