Could This Regex Work?
-
I had a conversation with AI, explained that I’m using WordPress Redirection pugin, that I’m using the following redirects: ^/(.*?)/amp/$ – ^/(.*?)/\?wpamp$ – ^/(.*?)/amp$ and that the target url for each is mywebsite.com/$1/
But that Google Search Console reports issues of urls with no trailing slash, extra trailing slashes, and sometimes cases of mywebsite.com/my-post/amp/?wpamp
AI suggested the following regex: ^/(.*?)/amp/?(\?wpamp)?$ to replace the 3 original redirects and that all cases of /amp/, /amp, /?wpamp, and /amp/?wpamp will redirect to mywebsite.com/my-post/ as expected.
Im not looking for a solution, just a hint. I have not tested it yet as I often find everything apparently works ok when testing, only for GSC to report errors a few days later.
So would just like to know if there is any obvious potential issue with that regex. Thanks
The topic ‘Could This Regex Work?’ is closed to new replies.