Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Different CSS for 2 Domains pointing to same directory

Quote Reply
Different CSS for 2 Domains pointing to same directory
I have two different domain names pointing to the same directory. So if a user goes to www.domain1.com I want the graphic in the header to be different than if the user goes to www.domain2.com.

I was wondering if there is some kind of javascript that I can use that can determine what domain is being used and perhaps allow me to use a different style sheet.

Any help would be appreciated.
Quote Reply
Re: [macbethgr] Different CSS for 2 Domains pointing to same directory In reply to
Hi,

I believe you need a license for each domain, I could be wrong...
Quote Reply
Re: [rascal] Different CSS for 2 Domains pointing to same directory In reply to
OK, That wasn't the question...... I already have 2 licences...
Quote Reply
Re: [macbethgr] Different CSS for 2 Domains pointing to same directory In reply to
You could do something like the following:

<%if db_referers eq 'www.domain1.com'%>
<%include include_header.html%>
<%else%>
<%include include_header2.html%>
<%endif%>
Quote Reply
Re: [rascal] Different CSS for 2 Domains pointing to same directory In reply to
That would probally work for a dynamic site, but since I use static sites I tried this and it seems to work:

In the include_common_head.html template I added the following:

<SCRIPT type="text/javascript">
var hst = location.host
document.write("<link type=text/css rel=stylesheet href=<%config.build_static_url%>/<%t%>/"+hst+".css />")
</SCRIPT>

I then copied and changed the names on the style sheets to match the domain names and made changes accordingly.