• Resolved chcw

    (@chcw)


    Hi,

    I define the redirect as below:

    Source: ^/my\-product/myfile\.(htm|html)

    Target: /my\-product\yourfile\.$1

    and check the “RegEx” option.

    However, Redirection will always said “Your target URL contains the invalid character \,\”.

    Should I escape the – and . in the source & target URL?

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

    (@johnny5)

    The source URL contains a regular expression. The target does not.

    You should escape any regular expression character in the source. You do not need to do it in the target

    Thread Starter chcw

    (@chcw)

    @johnny5

    Thank you. But the target URL contains $1 which is a found pattern in source URL. Even this will not cause the target as a regex? In which case, the target URL will be taken as regex?

    Plugin Author John Godley

    (@johnny5)

    Yes, the captured values are replaced. But it’s not a regular expression, and you don’t need to escape anything.

    Thread Starter chcw

    (@chcw)

    OK. Thank you very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Should I escape – and .’ is closed to new replies.