Disabling Default.aspx

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Disabling Default.aspx

Post by sdlong02 » Tue Sep 15, 2009 4:50 pm

Is there a way to prevent the automatic reroute from www.mysite.com to www.mysite.com/default.aspx?

They both load the same page, but sometimes the reroute doesn't happen so it's showing up as duplicate content since both versions of the URL are capable of being loaded

User avatar
igavemybest
Captain (CAPT)
Captain (CAPT)
Posts: 388
Joined: Sun Apr 06, 2008 5:47 pm

Re: Disabling Default.aspx

Post by igavemybest » Wed Sep 16, 2009 6:26 pm

There are 3 easy ways to do this...here we go...

1) In IIS on your host remove the default.aspx as a "default page". I dont reccomend it however, because if you have any other applications that use default.aspx, it will really jack things up for you.

2) When I had the same problem, the solution I found that worked best was to reside AC7 in a subdirectory application. I could then have a landing page directing to different subdirectory applications.

3) Use .htaccess and specify whatever you want to have as your default landing page. There is a great guide here: http://www.javascriptkit.com/howto/htaccess6.shtml so I will just quote from it:

"Some of you may be wondering, just what in the world is a DirectoryIndex? Well, grasshopper, this is a command which allows you to specify a file that is to be loaded as your default page whenever a directory or url request comes in, that does not specify a specific page. Tired of having yoursite.com/index.html come up when you go to yoursite.com? Want to change it to be yoursite.com/ILikePizzaSteve.html that comes up instead? No problem!

DirectoryIndex filename.htmlThis would cause filename.html to be treated as your default page, or default directory page. You can also append other filenames to it. You may want to have certain directories use a script as a default page. That's no problem too!

DirectoryIndex filename.html index.cgi index.pl default.htmPlacing the above command in your htaccess file will cause this to happen: When a user types in yoursite.com, your site will look for filename.html in your root directory (or any directory if you specify this in the global htaccess), and if it finds it, it will load that page as the default page. If it does not find filename.html, it will then look for index.cgi; if it finds that one, it will load it, if not, it will look for index.pl and the whole process repeats until it finds a file it can use. Basically, the list of files is read from left to right.

Every once in a while, I use this method for the following needs: Say I keep all my include files in a directory called include, and that I keep all my image files in a directory called images, I don't want people to be able to directory browse through them (even though we can prevent that through another htaccess trick, more later) I would specify a DirectoryIndex entry, in a specific htaccess file for those two directories, for /redirect/index.pl that is a redirect page (as explained here) that redirects a request for those directories to be sent to the homepage. Or I could just specify a directory index of index.pl and upload an index.pl file to each of those directories. Or I could just stick in an htaccess redirect page, which is our next subject!"

Post Reply