Help with URL redirect

Hi,

After my migration from wordpress I have many 404 (for a variety of reason, like : my writers used specific tag as link in their articles).

So I’m trying a variety of redirect. Simple one worked perfectly, for instance this one :

    /tag/expresso/: /expresso/

However some of my regex one don’t work, if this one works :

    ^\/\passe-au-crible\/dossiers\/([a-z0-9-]+)\/$:  /dossiers\/$1

This one doesn’t work :

    ^\/\tag\/([a-z0-9-]+)\/$: /blog/

Could you help me to writes regex to redirect all URL of a specific suburl ? Here an exemple of 404 I have and where I would like to redirect them :

https://thepixelpost.com/passe-au-crible/raptor-boyfriend-critique/attachment/20210718000846_1 => redirect any link matching /[SOMETHING]/attachement/[SOMETHING] to /

https://thepixelpost.com/tag/hunt-showdown => redirect any URL matching /tag/[SOMETHING] to /blog/

This one is a little complicated because I have other /tag/[SOMETHING]/ that are “harcoded” in redirect and are working as intented, for instance /tag/critiques/: /critiques/

Hope it was clear, don’t hesitate to ask for clarification, english is not my first language as such I can be a little … weird

Hi, after a little work I managed to do what I wanted to do.
Here’s a what I added !

    ^\/([a-z0-9-]+)\/feed\/: /rss/
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/feed\/: /rss/
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/([a-z0-9-]+)\/feed\/: /rss/
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/([a-z0-9-]+)\/([a-z0-9-]+)\/feed\/: /rss/
    ^\/tag/([a-z0-9-]+)\/([a-z0-9-]+)\/$: /blog/
    ^\/tag/([a-z0-9-]+)\/$: /blog/
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/attachment\/([a-zA-Z0-9-_]+)\/$: /
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/([a-z0-9-]+)\/attachment\/([a-zA-Z0-9-_]+)\/$: /
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/([a-z0-9-]+)\/attachment\/([a-zA-Z0-9-_]+)\/([a-z0-9-]+)\/$: /
    ^\/([a-z0-9-]+)\/([a-z0-9-]+)\/attachment\/([a-zA-Z0-9-_]+)\/([a-z0-9-]+)\/$: /

Everything seems to be fine so the moderators can mark the thread as solved

1 Like