3

I am updating the naming conventions on some old urls. I am using htaccess to redirect to the new urls.

I have some urls that use plus signs and these do not seem to want to redirect. For example:

RedirectMatch 301 (.*)-C++-Programming-Tutorial-C++-Seminar\.htm$ http://www.domain.com$1-C++-Training-Course.htm

Thanks!

T Percival
  • 8,526
  • 3
  • 43
  • 43

1 Answers1

3

Escape the + symbols with a backslash; they are interpreted as part of the regex and indicate that the preceding character should appear one-or-more times.

RedirectMatch 301 (.*)-C\+\+-Programming-Tutorial-C\+\+-Seminar\.htm$ http://www.domain.com$1-C++-Training-Course.htm
T Percival
  • 8,526
  • 3
  • 43
  • 43
  • The addition of the backslash does not seem to be working. The link is still not redirecting. – user2761359 Sep 10 '13 at 18:50
  • I need that because I have hundreds of urls that have a slightly different beginning part, but all the last part is the same(the part with the + signs) – user2761359 Sep 10 '13 at 18:59
  • It works for me. Did you reload the server after changing the configuration? Do you have any other rules that are matching before this one (and taking precedence)? Take a look at your access log & error log. – T Percival Sep 10 '13 at 19:01
  • no, I did not reload. I will give that shot in the morning when there is less traffic. Thank you for your help! – user2761359 Sep 10 '13 at 19:13
  • 1
    An Apache "reload" doesn't kill existing connections, only a "restart" does. See http://httpd.apache.org/docs/trunk/stopping.html#graceful - it should be safe to reload without interrupting your users. – T Percival Sep 10 '13 at 19:15