Originally posted by daacon Morning all
I don't know much HTML so if anyone here can help if would be appreciated.
I need to redirect 2 (possible more) urls comming into the same root of Apache server (windows - more specifically Apache Server that is part of the Oralce IAS suite). I have done this mumerous times with one incomming url with a simple index.html file placed on the root :
How can I place an If statment so that I can say sometyhing like:
If <incomming ur>l = 'htttp://page1.company.com"
then
go to "http:/redirect1.compnay.com"
elseif
<incomming ur> = 'htttp://page2.company.com"
then
go to "http:/redirect2.compnay.com"
...
...
Here is how I redirect one incomming - pretty simple stuff
<HTML>
<HEAD>
<TITLE><my Titlle></TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
window.location="<URL where I want to redriect to";
// End -->
</script>
<noscript>
<BODY>
You're overcomplicating things twice by using HTML and JavaScript, because Apache can already do this by itself.
You need to edit httpd.conf and add the following:
Code:
<VirtualHost 111.111.111.111>
ServerName page1.company.com
DocumentRoot /home/site1/html
RedirectPermanent / http://redirect1.company.com/
</VirtualHost>
<VirtualHost 111.111.111.111>
ServerName page2.company.com
DocumentRoot /home/site2/html
RedirectPermanent / http://redirect2.company.com/
</VirtualHost>
obviously changing 111.111.111.111 to the server's actual IP address, page1.etc and redirect1.etc to the actual hostnames, and /home/site1/html etc to the actual document roots. I hope this makes sense, if not read the Apache documentation and google "apache redirect".