Skip to main content

Posts

Showing posts with the label domain

One Tomcat instance for two domains and two webapps

How can I configure Tomcat (in standalone mode, that is without Apache [*]) so that I can deploy it on one server and have it serve two different webapps, depending on the domain name requested? I found a blog entry describing such a setup, but it's for Tomcat 5.5: <Engine defaultHost="domain1.com" name="Catalina"> <Host name="domain1.com" appBase="/home/user1/domain1"> <Alias>www.domain1.com</Alias> <Context path="" docBase="."/> </Host> <Host name="domain2.com" appBase="/home/user1/domain2"> <Alias>www.domain2.com</Alias> <Context path="" docBase="."/> </Host> http://iam-rakesh.blogspot.com/2009/10/hosting-multiple-domains-in-tomcat.html Also, as of now I've got one webapp, ROOT.war, inside .../tomcat/webapps/ How would that work once I'd have two "roots&quo

How do I select only the root domain from $_SERVER["HTTP_REFERER"];?

I want to have a 404 page that can detect if a user has come to that page either via my site, via my shortened URL or via another site, and I am making it using PHP. I am slowly getting to grips with PHP and this may well be a simple question, but I am quite tired to be honest and have no caffeine in my system, and I am wanting to tie up any loose ends in my portfolio as soon as possible. I have found the $_SERVER['HTTP_REFERER']; PHP variable gives me the entire URL, which is a start. Is there a way that this can give me only the root domain, either via another variable or a function, bearing in mind that some referrers may be using http:// and some https:// (so simply starting from the seventh character would not always work)? That way, I can match the URL based on two (or more) predefined addresses and produce the content that relates to that domain.