0

I need some guidance on how to redirect this the proper way...

I have a site on nginx and a bunch of malformed URL's (crawled by Search Console) that I need to redirect with 301.

My CMS is Wordpress and I need to redirect these URL's to /post_url/ removing all sufixes after 1 segment (/post_url/).

Malformed URL's examples:

  • https://www.example.com/post_url/tag/tag-one
  • https://www.example.com/post_url/tag/tag-two
  • https://www.example.com/post_url/tag/tag-three
  • etc.

I also need to preserve all tag's URL working like so => (https://www.example.com/tag/whatever), and I have no clue on how to do it...

4
  • Don't attempt to do this in nginx - configure the redirects in Wordpress.
    – symcbean
    Oct 19 at 14:51
  • @symcbean I'm missing the regex part... Can you elaborate?
    – btgen
    Oct 19 at 22:29
  • The specific syntax (and whether it uses regexes) will depend on which plugin you use for this.
    – symcbean
    Oct 20 at 8:09
  • but I don't want to use plugins...
    – btgen
    Oct 20 at 8:29

1 Answer 1

0

Adding this relevant question https://wordpress.stackexchange.com/questions/26388/how-can-i-create-custom-url-routes . There are other options such as using htaccess or a plugin to perform the redirects. Here is another relevant question for nginx, How to redirect requests to a different domain/url with nginx . If you have a specific issue with your nginx config, it'd be helpful to post that.

1
  • I'm missing the regex part... Can you elaborate?
    – btgen
    Oct 19 at 22:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .