PDA

View Full Version : How to redirect Custom Error pages


cosmoworlds
11-12-2006, 11:36 AM
Hello,

How should I redirect search engine visitors who arrive at a custom error page at our site to our homepage,
use a .htaccess file for this?

www.cosmoworlds.com (http://www.cosmoworlds.com) is a simple html site, not ASP.

Or is there anywhere I can read about this?

Thank you,
Frank

edified
11-13-2006, 07:47 AM
.htaccess is only available on unix hosts.

What URL are they landing at and where do you want it to go? You can send header request fairly simply in php.

Check this out: www.php.net/header (http://www.php.net/header).

or here's a simple php snippet:

[quote]
<?php
header('Location:http://brockhuman.com/');
?>
</CODE>

A page with this code tell the browser to redirect to 'brockhuman.com/ (http://brockhuman.com/)' before any html or javascript even loads.

If all else fails you can just move to a unix host (DASP suggests it for static HTML) and use .htaccess or their error page tools. My UNIX host is dreamhost.com and I'm happy. Contact me (http ://edified.org/contact) if you're interested and I'll get you a code for $32 for your first year of hosting (I think the coupon code is 'LOVEKEVIN').

Ed Palma (http://edified.org/resume) - edified.org (http://edified.org/)

joelnet
11-13-2006, 11:48 AM
Ok, don't listen to Edified. He has no idea what he's talking about.

If you want to redirect all 404 error (page not found) to your home page all you have to do is...

log into your control panel.
click on IIS Manager.
click on the Custom Errors tab.
In the 404 box, type the name of index page. (ie: default.html, index.html, etc.)


If this is not what you want to do, please explain your desired behavior.





I've also never seen DASP recommend a UNIX host for static HTML, where did you see this?


Joel Thoms
DiscountASP.NET
http://www.DiscountASP.NET

mjp
11-14-2006, 02:12 AM
Joel Thoms said...
I've also never seen DASP recommend a UNIX host for static HTML, where did you see this?
Blame Bruce. ;)

http://community.discountasp.net/default.aspx?f=12&m=12690&g=14198#m12754

mjp
DiscountASP.NET
<SUB><SUP>http://DiscountASP.NET (http://DiscountASP.NET)

joelnet
11-15-2006, 03:57 AM
haha ok I will.

I still give recommendations to my friends to host their static sites here. Simply for the uptime, control panel, and email features we offer. Though I would like to see more bandwidth offered :)


Joel Thoms
DiscountASP.NET
http://www.DiscountASP.NET

cosmoworlds
11-16-2006, 02:48 AM
Thanks Joel and Edified
You are right Joel, that's exactly what I was looking for, it works.

Cosmoworlds - www.cosmoworlds.com (http://www.cosmoworlds.com)

eriveroglc
01-09-2007, 06:26 AM
Do you have the code for redirect domainto subdirectory?

vvsharma
01-09-2007, 08:43 AM
You could have something like the following in your default page :

if (Request.Url.ToString().Contains('domain.com'))
{
Response.Redirect('/sub-directory');

}

Vikram

DiscountASP.NET
www.DiscountASP.NET (http://www.discountasp.net/)

Post Edited (vvsharma) : 1/9/2007 8:56:00 PM GMT