java redirect 301

Asked

Viewed 95 times

1

I need to do a permanent directing via Servlet in java, with the code below:

Here it directs with the status 301

response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location", "https://google.com");

Here it directs with the status 200

response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
response.setHeader("Location", "https://www.google.com");

Does anyone know why you don’t behave the same way? I’m having problems directing to other domains, where they always get status 200.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.