Forum Moderators: phranque

Message Too Old, No Replies

How can i Re-write this URL of my site, through .htaccess

anydir/index.htm to anydir/

         

hgupta

11:24 am on Jan 4, 2007 (gmt 0)

10+ Year Member



Hello,

I have searched internet maniac of time to find what i am seeking of, this is how i found how to fix canonical issues, URL redirection,
right now i want to redirect one URL through .htaccess file, but couldn't do..

Please suggest me the code:
http://www.example.com/123/index.htm >> change to >>
http://www.example.com/123/

I want to remove the index.htm portion by redirection, my site is under apache server, please help me get the right code for it..

H.Gupta
----------

[edited by: jdMorgan at 2:57 pm (utc) on Jan. 4, 2007]
[edit reason] No specifics, please. See Terms of Service. [/edit]

jdMorgan

3:07 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As derived from [webmasterworld.com...] and several other previous threads on this subject, available through our site search [webmasterworld.com]:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/
RewriteRule ^(([^/]+/)*)index\.htm$ http://www.example.com/$1 [R=301,L]

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim