Title: Regex Help
Last modified: May 6, 2024

---

# Regex Help

 *  Resolved [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/)
 *     ```wp-block-code
       In WordPress general settings My site is set to:
   
       WordPress Address (URL) https://www.mywebsite.com
       Site Address (URL) https://www.mywebsite.com
   
       Permalink settings:
   
       Post name - https://www.mywebsite.com/sample-post/
   
       In Redirection "site" settings I selected "Don't set a preferred domain"
   
       I moved my site from Blogspot.com around 11 years ago. The blogspot permalinks were:
       www.mywebsite.com/yyyy/mm/my-post.html
   
       My current redirect for the old blogspot format is:
   
       source = ^/\d{4}/\d{2}/(.*).html$
       target = https://www.mywebsite.com/$1/
   
       I've used the official AMP plugin, AMP for WP, and AMP Ninja, but not for several years, and currently use the following redirects:
   
       source = ^/(.*?)/amp/$
       target = https://www.mywebsite.com/$1/
   
       source = ^/(.*?)/amp$
       target = https://www.mywebsite.com/$1/
   
       source = ^/(.*?)/\?wpamp$
       target = https://www.mywebsite.com/$1/
   
       source = ^/(.*?)/\?amp$
       target = https://www.mywebsite.com/$1/
   
       Along with those I have some redirects from old "deleted" posts to new post, and from tags to categories and categories to tags.
   
       In Google Search Console, indexing > pages, I have 3.84k pages not indexeed. 2,144 of those are "page with redirect." That's reduced from 5000+ over the last couple of years, but Google reports new problems every 3 - 4 days.
   
       I've changed the redirect several times over the year or so, most recently just a few days ago, and using the https://redirect.li/ checker I though I had finally cracked it, until Search Console updated and reported the same persistent errors.
   
       Those errors iclude, page with redirect:
   
       https://www.mywebsite.com/my-post
       https://www.mywebsite.comm/my-post//1000
       https://www.mywebsite.com/my-post/1000
       https://www.mywebsite.com/my-post//
       https://www.mywebsite.com/amp/?wpamp
       https://www.mywebsite.com/?p=12345
   
       In some cases https://www.mywebsite.com/my-post/ is simply https://www.mywebsite.com/my
   
       On click from Search Console, they all redirect to the canonical url.
   
       Before I try again, is there something about the redirects that is obvioulsly worong?
       ```
   

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

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17734804)
 * There’s a lot of information there and I can’t realistically tell you if anything
   is wrong for a site for which I have no knowledge or context. It can take quite
   a long time for Google to update, so sometimes patience is all that is required.
   If not then the information provided by Google is the key to understanding their
   results – there may be other factors involved.
 *  Thread Starter [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17734864)
 * Thanks John, and understood. Is possible the redirects are conflicting with each
   other, causing the double trailing slash?
 * Something I noticed in the Redirection log also is source url /my-post/amp/?wpamp–
   redirecting to target url /my-post/amp/
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735386)
 * > Is possible the redirects are conflicting with each other, causing the double
   > trailing slash?
 * It’s not really a thing that happens. You can use the information in Google to
   test your URLs (using [https://redirect.li/](https://redirect.li/)) and see what
   happens. It should be reasonably obvious if a redirect is not doing what you 
   want.
 * > Something I noticed in the Redirection log also is source url /my-post/amp/?
   > wpamp – redirecting to target url /my-post/amp/
 * Is that right or wrong?
 *  Thread Starter [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735431)
 * > Is that right or wrong?
 * It looks wrong, like it should direct redirect to the canonical but it doesn’t.
 * There are several examples. When I click on “View redirect” from the log the 
   source is ^/(.*?)/\?wpamp$
 * It’s only some what behave like this, others redirect straight to the canonical
   without jumping on the back of /amp/
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735433)
 * You can use [https://redirect.li](https://redirect.li) to see what is happening
   with the redirect and adjust things as necessary.
 *  Thread Starter [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735438)
 * Yes, will give it a go. I used that to test initially and everything looked ok.
   Thanks for your time John, really appreciate.
 *  Thread Starter [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735468)
 * In direct.li my-post/amp/?wpamp redirects to my-post/amp/ (301) then to canonical(
   200)
 * my-post/?wpamp redirects to canonical
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735484)
 * I don’t think that will cause pages not to be indexed, but you can experiment
   using the available information.
 *  Thread Starter [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * (@darrenc66)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735485)
 * Ok, many thanks John. Hope I havent wasted too much of your time 🙂

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

The topic ‘Regex Help’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [darrenc66](https://wordpress.org/support/users/darrenc66/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/regex-help-6/#post-17735485)
 * Status: resolved