0

I am using Search Regex plugin to update some content in the Wordpress database and have managed to replace string (i.e. replace all instance of stringone with stringtwo) but I am looking into finding all the urls in are in the database that don't have a trailing slash and add one at the end. This task seems to be bit challanging with this plugin.

The url https://www.test.com/path/otherpath becomes https://www.test.com/path/otherpath/

There must be other ways to accomplish this task so would be good to have some idea. PS - I am new to wordpress and php. Thanks

I have tried finding similar issues on stack overflow and reading Search Regex documentation to do this without much success.

Tami
  • 3
  • 2

1 Answers1

0

Regex is usually the way to go, you need to transform your search to a regex expression to get all appearences without trailing slash

For your example, that would be:

^https?:\/\/(?:.*\/)?[^\/.]+$

See also: Regex to match an URL without a trailing slash also no file extension

The replacement would be the original value + "/". I don't know the plugin but it should be possible to set this.

Chrostip Schaejn
  • 2,347
  • 1
  • 6
  • 13