homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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

5+ Year Member

Msg#: 3845043 posted 4:28 pm on Feb 8, 2009 (gmt 0)

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



Msg#: 3845043 posted 7:05 pm on Feb 8, 2009 (gmt 0)

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


5+ Year Member

Msg#: 3845043 posted 8:37 pm on Feb 8, 2009 (gmt 0)

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.


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

Msg#: 3845043 posted 10:48 pm on Feb 8, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved