Permalink change and Regex

  • Hi,

    I have to change my permalinks, from domain/category/postname to domain/postname. Can you please help writing the proper Regex code to do this?

    Best regards
    Antonio Jorge

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for getting in touch with us.

    You can try the following regex:

    
    Source URL: ^/%category%/(.+)$
    Type: Regex
    Destination URL: https://yoursite.com/$1
    

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hi Michael,

    Thanks for your answer. However, after I entered the regex and saved it, ^/%category%/(.+)$ turns into ^/tegory%/(.+)$. Everytime I tryed, (%ca) is removed from code and the resulting regex doesnt work.

    Can you please solve this?

    Regards
    A Jorge

    Hello,

    Please try without the % sign and this in the source:
    /category/(.*)$

    Here is a screencast showing that it works:
    https://i.rankmath.com/xSo2QS

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hi Uzair,

    Did you checked your screencast? It seems to end up with a PAGE NOT FOUND screen.

    Regards
    A Jorge

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

You must be logged in to reply to this ticket.