Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Script to redirect website

Script to redirect website
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 6, 2003, 08:41 PM
 
Hi,

I am exceeding my bandwidth with my current web hosting company so whenever someone tries to connect they get a 408 Request Timeout error. I have space on some other servers, like my .Mac account, but I don't know how to redirect users. Does anyone know how I can make it so that when a user gets a 408 error they will get redirected to a different URL?

I don't know much about web programming, so any help would be greatly appreciated.
     
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jan 7, 2003, 08:59 PM
 
That's something you'd have to discuss with your webhoster, since that's server-side configuration. Unless you have access to server configurations? It's fairly technical though. I'd suggest contacting your host first and then come back here.
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 8, 2003, 04:09 PM
 
I asked my webhoster and this is what they said:

Create one error page and and store it in your httpdocs.So whenever you get the error 408 it will redirected to your customised page.
You can do this by adding the following line in your .htaccess file,
ErrorDocument 408 /path your error page.

I just don't know exactly how to code it?

Can someone post an example?

Thanks.
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jan 8, 2003, 05:52 PM
 
Originally posted by macrophyllum:
I asked my webhoster and this is what they said:

Create one error page and and store it in your httpdocs.So whenever you get the error 408 it will redirected to your customised page.
You can do this by adding the following line in your .htaccess file,
ErrorDocument 408 /path your error page.

I just don't know exactly how to code it?

Can someone post an example?

Thanks.
Just what they said, essentially!

Create a file on your desktop using (preferably) BBEdit, making sure UNIX style linefeeds are being used rather than Mac linefeeds - UNIX hates the combination of /r/n. You could also try using TextEdit on Mac OS X, or indeed any other text editor that allows you to create plain text files with UNIX style linefeeds.

(Note: I'm assuming you ARE using a UNIX/LINUX server... if you're running a windows box, then obviously use DOS style linefeeds!)

Make a file called 'htaccess' - no extensions. The correct name is actually '.htaccess' but most editors won't let you create a file with a '.' at the front of the file in OS X (not sure about OS 9 - it's been a while..)

If you'd like to redirect your users to an address called 'http://www.your-other-url.com/index.html' then you need only create 1 line which says:

That's it! Now upload that file to your top-level web directory on your server (the same one your index.html or default.htm file is kept) and rename it to .htaccess.

Should work straight away, although you're not really going to get an accurate indication until you're exceeding your bandwidth again.

Hope that helps
Computer thez nohhh...
     
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jan 8, 2003, 06:04 PM
 
Good response except one thing: there's probably already a .htaccess file available when you log-on. Make sure you just edit this file rather than replacing it with a file that *only* has the 408 redirect on it. Good luck.

Travis
forté web design

edit:// Of course, if there isn't a file already just upload your own.
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 8, 2003, 06:13 PM
 
Thanks folks! Works now. Once I uploaded the file I added "." to .htaccess.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:01 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2