• Resolved matteone55

    (@matteone55)


    Hello,
    I’m trying to redirect all the Search result pages (mydomain.com/?s=search_query) to my home page (mydomain.com)

    I tried with the following regular expressions:

    ^/?s=(.*)$
    and
    /?s=(.*)

    asking the plugin to redirect to mydomain.com/

    but they both redirect to https://www.mydomain.com/?https://www_mydomain_com/

    (Please, note the underscores in the second part of the url)

    How can I create a wildcard redirection so that, regardless of what appears after mydomain.com/?s= the user is always redirected to the homepage (without any additional part in the url)?

    Thank you in advance, Matteo

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Godley

    (@johnny5)

    Note that ? is a regular expression character so you will need to escape it as \?. If you don’t want to capture the search data then you also don’t need the brackets.

    Thread Starter matteone55

    (@matteone55)

    Thank you very much John,

    I’m using this expression now and it seems to work great:

    ^/\?s=(.*)$

    I’d like to ask… in order NOT to have issues with other plugins which could add some string including /?s= in other parts of the URL, is it right to use the ^ and $ signs at the beginning and end of the expression?

    Is it enough to tell the plugin to catch only the case when that part of URL appears just after mydomain.com?

    Thank you so much,
    Matteo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Wildcard problem’ is closed to new replies.