Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
07-05-2007, 06:27 AM   #1
Veteran Member
daacon's Avatar

Join Date: Mar 2007
Location: Alberta,Canada
Photos: Gallery
Posts: 20,914
HTML Redirect Help Needed

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>

</BODY>
</HTML>

07-06-2007, 12:21 PM   #2
Veteran Member
slip's Avatar

Join Date: Oct 2006
Location: 2 hours north of toronto ontario canada
Photos: Gallery | Albums
Posts: 3,535
I don't know much about apache servers but you can do what I have done in the past....
find a simular redirect page and swap out the redirected URL's of the page for your URL's.

hope this helps

randy
07-06-2007, 01:02 PM   #3
Junior Member




Join Date: Nov 2006
Location: Bendigo, Victoria, AU
Posts: 43
QuoteOriginally posted by daacon Quote
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".
07-06-2007, 03:15 PM   #4
Senior Member
c.r.brown's Avatar

Join Date: Jul 2007
Location: Atlanta, GA
Posts: 214
or you can do a simple META tag...

Code:
<meta http-equiv="refresh" content="0;URL=YOUR_URL.COM" />


07-06-2007, 04:23 PM   #5
Veteran Member
daacon's Avatar

Join Date: Mar 2007
Location: Alberta,Canada
Photos: Gallery
Posts: 20,914
Original Poster
Thnaks for all the replies

Thanks everyone - I eventually hacked my way through it (html / Java script not my strong suit) with some simple script - I wanted to use Virtual Host in the http.conf file - but this is oracle’s implementation of Apache working with a third party application and these servers behind a hardware Cisco Load balancer - so a few other things needed to be changed - Iwanted it simple.

What I eventually did was as follows;

Found a Web Server and created an index.htm file. Had the network guys (I am a dba by trade know enough networking to be dangerous haha) have all the shortcuts I needed routed to the root of the web server. The index.html file interpreted the incoming url and redirected as needed.

Not the slickest I am sure - but it suits my needs and is easy to add / change / maintain.

Eg:
<html>
<head>
<SCRIPT TYPE="text/javascript">
function init()
{
if (window.location=="http://shortcut1.company.com/")
window.location.href="http://www.company.com/big/long/ugly/url1";
if (window.location=="http://shortcut2.company.com/")
window.location.href="http://www.company.com/big/long/ugly/url2";
if (window.location=="http://shortcut3.company.com/")
window.location.href="http://www.company.com/big/long/ugly/url3";
..
..
..
}
</SCRIPT>
</head>
<BODY onLoad="init()"
</body>
</html>

Last edited by daacon; 07-06-2007 at 06:13 PM. Reason: Syntax fix missing }
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
apache, html, root, server

Similar Threads
Thread Thread Starter Forum Replies Last Post
News HTML Validation Completed Adam Site Suggestions and Help 1 10-22-2010 09:17 AM
HTML code on/off ??? Lilly Site Suggestions and Help 2 03-19-2008 06:22 AM
Help needed.. baw Pentax DSLR Discussion 2 12-10-2007 04:34 AM



All times are GMT -7. The time now is 04:46 PM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top