I want to redirect non /category/ links to /category/.

#410089
Viewing 8 replies - 1 through 8 (of 8 total)
  • I want to change in permalink structure(non /category/ links) to /category/ and 301 redirect all non /category website URLs to a /category/ base URL structure through rankmath plugin.

    Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support.

    Firstly, we don’t recommend changing the permalink structure on a live website and especially if the pages have already been indexed as this could potentially affect the rankings.

    That said, that redirection is part of the permalink structure modification of the website. You can head over to your WordPress admin area > Settings > Permalinks, and create a custom structure like this:

    In the case of permalink modifications, the redirections are automatically handled by WordPress itself. However, in case it doesn’t work, you can also consider Regex expressions in our Redirection module to create redirections for this: https://rankmath.com/kb/how-to-use-regex-redirects/

    Hope this helps.

    Thank you.

    When I do modifications in the permalink structure like- https://samacharnagari.in/%category%/%postname%/, the website URL redirects correctly to the new category base URL structure but the problem is- google indexed content is not redirected and shows 404 errors.

    Kindly help how can I 301 permanently redirect non /category/ links to /category/.

    Also, mention the ‘Regex Source URL:’ and ‘Destination URL:’ to redirect(301) all content.

    Hello,

    I checked the article URL you first shared and it seems that the permalink is currently configured without the category.

    Could you please confirm if you reverted the permalink structure setting back to its previous setting?

    You may share the URL that is currently redirecting to a 404 so we can further check from our end.

    Looking forward to helping you on this one.

    Yes, reverted the permalink structure setting back to its previous setting because google indexed content was not redirected on the new url and shows 404 errors.

    could you tell me the rank math ‘Regex Source URL:’ and ‘Destination URL:’ shortcode so that I can permanently redirect non /category/ links to /category/ on all content after changes in permalink structure and rank math redirection.

    Hello,

    Unfortunately, a regex type redirection in our plugin may not be able to tell a current “non-category” URL what should be its category associated with the post.

    You can set the redirect like below but this will not be an effective solution as there’s no way to tell which category a current post URL should go to.

    Source: (.*)
    Match: Regex
    Destination: /my-category/$1

    In addition, when changing a permalink structure, WordPress itself should create a redirection automatically for you as mentioned previously by my colleague. Could you please confirm if this isn’t the case from your end?

    Looking forward to helping you on this one.

    Hi,

    This one is not working.

    Source: (.*)
    Match: Regex
    Destination: /my-category/$1

    I have changed in permalink structure https://samacharnagari.in/%category%/%postname%/, and google indexed article not redirected- 404 not found.

    Kindly click check any indexed content from the below link

    https://www.google.com/search?q=site:samacharnagari.in&sxsrf=ALiCzsa61XSTugAErhjjUe69Q6SY-MuAoQ:1656350533662&ei=Ree5Yq2BKJbV4-EPq76XqAY&start=60&sa=N&ved=2ahUKEwjtt7rJks74AhWW6jgGHSvfBWU4RhDy0wN6BAgBED8&cshid=1656350595092594&biw=1366&bih=657&dpr=1

    Prabhat
    Rank Math agency

    Hello,

    As you want to redirect non-category URLs to the category ones, unfortunately, REGEX would not be a viable option as WordPress allows creating URLs with the same slug in different post types, it is not possible to detect the category of a URL only with the slug in our redirection module. Regex could have been used if the redirection was the other way around.

    If the WordPress redirections are not working, unfortunately, you’ll have to manually redirect the URLs.

    Please feel free to let us know if you require any further assistance.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

The ticket ‘I want to redirect non /category/ links to /category/.’ is closed to new replies.