Search code examples
cssjsfurl-rewritingglassfishprettyfaces

Redirect CSS URL to one without www subdomain


I would like to know if there is a way to remove www (or add) when happens a request.

Here's my problem:

I'm inserting CSS this way: "//domain.com.br/resources/cssname.css"

if I access a page http, everything works perfectly, but when I access a page https USING "www.domain.com.br" the page doesn't load CSS files

if I insert CSS like this: "//WWW.domain.com.br/resources/cssname.css" the oposite happens, and when i access a page using "domain.com.br" there is no css.

Could I change all requests when using remove wwww or all request add www?

I saw that prettyfaces has could that be done using this?

Also, I'm using glassfish, I don't know if this can be done by there or by provider.

Thanks.


Solution

  • Personally, I always use:

    #{facesContext.externalContext.requestContextPath}/resources/cssname.css
    

    As the path to any of my resources. This way, I am sure that I am always getting the right path to my resource.

    Hope this helps Cheers