How to config Apache2 to redirect URL

Apache2redirect

I am trying to config url redirect in Apache. I have tried some approaches and nothing works. Can someone tell me the solution of this as it doesn't seem too difficult.

I am going to redirect request from:

https://myhost/configuration/jmx-console

to:

http://myanohterhost/jmx-console

This is a https to http re-direct.

Can someone point me to the right direction?

Many thanks!

Best Answer

You could use the RedirectMatch directive to force Apache to send the user someplace else:

RedirectMatch 301 ^(.*)$ http://www.anotherserver.com$1

See the following:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch

http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_codes_3xx

Related Topic