3

I have multiple URLs that follow the same pattern like this:

https://example.com/hashtag?tag=[$string]

Is there a way to perform a 301 redirect to the following URL instead?

https://example.com/tags/[$string]

If I use this plugin, Safe Redirect Manager, is there a way to set that up?

My Server:

  • VPS CenterOS
  • NGINX
1
  • Has your question been solved? If so, please click the green checkbox next to my answer so it let's the community know. Commented Aug 22, 2016 at 17:32

2 Answers 2

3

From doing some research, I'd recommend trying out this plugin: Redirection. This plugin allows you to manage 301 redirections.

I played around with the settings and they allows regular expressions which could do the following:

http://some.site/hashtag?tag=some-tag/ to http://some.site/tags/some-tag/

They provide documentation on how to set it up which can be found here. This is what I've done when creating the rule, try this:

enter image description here

  • Source URL: /hashtag?tag=(.*)/
  • Target URL: /tags/(.*)

I was testing this out on a local copy of WordPress and I don't have anything right now that gives me those URL structures. Let me know if that works for you on your end. Again, you can play around with the regular expressions to get it right.

2
  • Thank Ethan Jinks O'Sullivan, this is a perfect solution ;)
    – NvD
    Commented Aug 31, 2016 at 15:04
  • @NvD Great, glad this helped. Commented Aug 31, 2016 at 15:07
0

This isn't quite right.

  1. Source URL: /hashtag?tag=(.*)/
  2. Target URL: /tags/$1

The Dollar symbol says match that first value ($2 would be the second, which isn't required here)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.