Recipe 5.9 Redirecting Several URLs to the Same Destination


You want to redirect a number of URLs to the same place. For example, you want to redirect requests for /fish and /Fishing to


Use RedirectMatch in httpd.conf to match against a regular expression:

RedirectMatch ^/[fF]ish(ing)?


This recipe redirects requests on one server for URLs starting with fish or fishing, with either an upper-case or lower-case f, to a URL on another server, As with Redirect, the path information, if any, is preserved. That is, a request for http://original.server/Fishing/tackle.html is redirected to so that existing relative links continue to work.

As with several of the earlier examples, RedirectMatch uses regular expressions to provide arbitrary text pattern matching.

See Also

  • Appendix A

Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: