How do we redirect all requests to one domain to a section of another domain?

12,848

In a .htaccess file on the server

Redirect permanent http://www.example.net/index.jsp http://www.example.com/example_section/index.jsp.

Or you can create page at http://www.example.net/index.jsp page and add

<% 
    String redirectURL = "http://www.example.com/example_section/index.jsp"; 
    response.sendRedirect(redirectURL);
%> 

Or you can write on the same page

<jsp: forward page="http://www.example.com/example_section/index.jsp"/>

This will forward the page.

Share:
12,848
daehaai
Author by

daehaai

Updated on June 04, 2022

Comments

  • daehaai
    daehaai almost 2 years

    We have two domains, example.com and example.net· We want every request to example.net to redirect to example.com/example_section/index.jsp. How can we achieve that?