Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect example.com/ to example.com/index.html



4:28 pm on Feb 8, 2009 (gmt 0)

5+ Year Member

I found examples for the opposite of what I want, but I can't work out how to reverse it.

What I need is this:

I want http://www.example.com (and http://www.example.com/) to rewrite into http://www.example.com/index.html


7:05 pm on Feb 8, 2009 (gmt 0)

You can check this thread: [webmasterworld.com...]


8:37 pm on Feb 8, 2009 (gmt 0)

5+ Year Member

Ok, thanks. I now know how to do it...but I never considered the fact that it may have consequences for my page ranking/listing.
The reason I want the root to point explicitly to the index.html is because I use a JavaScript to highlight the current menu-item, and this item is found by comparing the href in the link to the current page-name.

Oh well, back to the drawing board.


10:48 pm on Feb 8, 2009 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

You can still do it.

Either test for a URL ending in "/" to know that it is for an index page... or you can test for SCRIPT_NAME or somesuch which will tell you the name of the file on the server that the requested URL was mapped to. In this case, even though the requested URL was "/", SCRIPT_NAME will return "/index.html" for you.

Whatever you do, the URL used out on the web (i.e. in links), should be the one ending in a slash, and not including the index file filename itself.


Featured Threads

Hot Threads This Week

Hot Threads This Month