I have a apache server, which applies mod_rewrite and mod_proxy based on a rewrite mapping file. The user just accesses the server, and does not know that he is redirected to another server supplying the source files. Everything is handled by apache in background.
As I'd now like to have more complexe redirecting, I thought about some solution within java/jsf/servlet.
Can I achieve the same robust remapping of an url from a servlet? If so, how could I start?
If it's on the same machine you can use forward:
request.getRequestDispatcher("pathToNewServletOrJsp").forward(request, response);
(with the relative path) and the URL will not change, otherwise you have to use sendRedirect:
response.sendRedirect("pathToNewServletOrJsp");
and in this case - the URL will change.
.htaccess file.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With