Fórum

Site configuration to avoid redirects

Klaus Bachmaier, modificado 7 Anos atrás.

Site configuration to avoid redirects

Regular Member Postagens: 223 Data de Entrada: 30/09/13 Postagens Recentes
I've setup a Liferay portal for a customer with multiple websites (LR 6.2). The "main" website is configured to use the virtual host "www.mycompany.com". I want to achieve that when a users enter "http://www.mycompany.com" in the browsers address field, the portal should open the first public page of this website without doing any redirects or appending a page title to that URL. I've managed to setup a local testserver on my developer PC which behaves exactly that way, but somehow I can't get the customers server configured to behave as described.

This is what I've tried on the customers server:

In "portal settings" I left the "virtual host" field untouched, so that it still shows "localhost". I've entered a "Home URL" setting "/home". As said above, in the site settings, under "Site URL" I've set the virtual host for public pages to "www.mycompany.com". Now, when a user enters "http://www.mycompany.com" in a Browsers address field, Liferay responds with a...

404 not found
client side redirect to www.mycompany.com/c
302 found
redirect to www.mycompany.com/home

This is bad behaviour when it comes to SEO optimization, and I wanted to avoid all this 404 and 302 redirects.

On my local PC I just removed the "Home URL" setting in "portal settings", and when I call the URL defined as "virtual host" for my website the site get's opened with the first public page of the site, without any redirects or appending a page name after the virtual host URL. So in my case it just openes "http://www.mycompany.com" with status 200 showing the first public page of the website.

But on the customers server when I remove the "Home URL" from server settings, I get a "Not found" Error screen, and I see a 404 status in Chrome's developer tools.

So what would be the right approach to configure the server so that it opens just the first page of a website without doing any redirects or giving "404" responses? Any ideas why both servers behave so differently?