Create a custom 404 page

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
DelectablyYoursDecor
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Fri Aug 08, 2008 8:39 am
Location: Harrisburg, PA
Contact:

Create a custom 404 page

Post by DelectablyYoursDecor » Tue Oct 07, 2008 9:13 am

Hi, I have been searching the boards for several days trying to find a solution for creating a custom 404 page. I'm assuming i must do from the base files manager but didn't know if there was a better way. I had moved my domain names from a different platform and there are many links still out there. Any assistance as to where to look would be greatly appreciated.

Thanks... Gail

http://www.Delectably-Yours.com
http://www.yourcabindecor.com
http://sellingbeyondebay.ning.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Create a custom 404 page

Post by mazhar » Tue Oct 07, 2008 9:52 am

In order to provide a error page for status code 404. First create a new page for example let say it FileNotFound.aspx and place it at root of the website. Now Edit the web.config file
and locate the customErrors tag and make it look like

Code: Select all

<customErrors mode="On" defaultRedirect="~/Error.aspx">
      <error statusCode="404" redirect="~/FileNotFound.aspx"/>
    </customErrors>
where defaultRedirect="~/Error.aspx" it the default page you can create another page for this purpose and can provide its name here.

Also there is a topic about 301 redirects pages on the wiki here
http://wiki.ablecommerce.com/index.php/ ... leCommerce
Its not related to this post, just to let you know about the AbleCommerce WIKI :wink: .

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Create a custom 404 page

Post by mazhar » Tue Oct 07, 2008 10:17 am

A WIKI topic created for 404 pages.
http://wiki.ablecommerce.com/index.php/ ... Error_Page

User avatar
DelectablyYoursDecor
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Fri Aug 08, 2008 8:39 am
Location: Harrisburg, PA
Contact:

Re: Create a custom 404 page

Post by DelectablyYoursDecor » Tue Oct 07, 2008 10:27 am

Thanks Mazhar!

I will give this a try and post back how it works. I was tempted to just hire someone to do yet would like to know how to do more myself. Which could be scarry lol :roll:

User avatar
DelectablyYoursDecor
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Fri Aug 08, 2008 8:39 am
Location: Harrisburg, PA
Contact:

Re: Create a custom 404 page

Post by DelectablyYoursDecor » Tue Oct 07, 2008 12:25 pm

Help... It didn't work, what am i missing?

I created the file at the root, changed the code for custom 404 in web.config to

<customErrors mode="On" defaultRedirect="~/ErrorPages/Default.aspx">
<error statusCode="404" redirect="~/ErrorPages/FileNotFound.aspx"/>
</customErrors>

and added the two pages exactly as you named. When attempting to see if the redirect works, say http://www.delectably-yours.com/website neither of the custom pages are redirecting. http://www.delectably-yours.com/ErrorPages/Default.aspx or http://www.delectably-yours.com/ErrorPa ... Found.aspx

Any help is appreciated! :wink:

meer2005
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Feb 09, 2005 2:00 pm

Re: Create a custom 404 page

Post by meer2005 » Wed Oct 08, 2008 4:22 pm

I could never get it to work when I put the custom erorrs mode like above:
<customErrors mode="On" defaultRedirect="~/Error.aspx">
<error statusCode="404" redirect="~/FileNotFound.aspx"/>
</customErrors>



I have this and it seems to work:
<customErrors mode="RemoteOnly" defaultRedirect="/404page.aspx"/>

It seems to catch the 404 errors with what I put above.
I could never get the error statusCode to work, any clues???

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Create a custom 404 page

Post by mazhar » Thu Oct 09, 2008 7:15 am

<customErrors mode="On" defaultRedirect="~/Error.aspx">
<error statusCode="404" redirect="~/FileNotFound.aspx"/>
</customErrors>
The above settings only works for an ASP resource request. For example if you provide some invalid URL for some ASPX page it work fine and redirect you to the desired page.
For invalid URLs that just point to some directory for example
http://www.delectably-yours.com/website
or for the resources other then the ASPX pages like for HTML pages for example
http://www.delectably-yours.com/abcd.html
You have to configure the IIS custom error pages.

In order to do this create a HTML page with some suitable error message and then place it along with the other aspx error pages created in the above step. Now from the IIS open Properties dialog of your web directory and then select the Custom Errors tab. Now locate the entries there with error code 404. Edit the 404 entry and then browse your newly created HTML page there.

Post Reply