Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My current setup has two virtual-servers, my-server redirects to the domain with www. prefix.

<virtual-server network-listeners="my-nlistener" id="my-server" sso-cookie-http-only="false" hosts="mydomain.com">
  <property name="redirect_1" value="from=/my-page.jsp url-prefix=http://www.mydomain.com/my-page.jsp"/>
  <property name="redirect_2" value="from=/about.jsp url-prefix=http://www.mydomain.com/about.jsp"/>      
<virtual-server network-listeners="my-nlistener" id="my-new-server" sso-cookie-http-only="false" hosts="www.mydomain.com">      

Unfortunately, for SEO compliance, I need to do 301 redirects and not 302

How do I force 301 redirects in GlassFish like in Apache? Or is it a better practice to keep only one virtual-server and have multiple hosts as such : <virtual-server id="my-new-server" hosts="www.mydomain.com, domain.com">.

I would love to avoid creating a Spring application to do 301 redirects for the specified pages.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.