1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Remove Index.html from URL

Discussion in 'HTML & Website Design' started by B.Williams, Jan 18, 2010.

  1. #1
    Hey DP experts. I want to know that how to remove index.html from URL. E.g:
    SEMrush
    I want to redirect url like

    www.domain.com/index.html

    to
    simple
    www.domain.com/

    how to redirect it without any issue. I heard it can be possible through .htaccess file. But i dont know how to used and implement it to website. Can you guys help me.
     
    B.Williams, Jan 18, 2010 IP
    SEMrush
  2. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Change the link that goes to your homepage tpo the website address.
    You may have:
    
    <a href="index.html">Link Here</a>
    
    Code (markup):
    Change that to:
    
    <a href="http://www.domain.com">Link</a>
    
    Code (markup):
     
    jonathandey, Jan 18, 2010 IP
  3. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hey if do it and rename my index.html to my domain.com. Will it effects on SEO of my website or effect on SERP ?? Is it safe side in SEO purpose ?
     
    B.Williams, Jan 18, 2010 IP
  4. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    You are not really renaming the index.html file, all you are doing is changing the link to your website address.
    This shouldn't the affect SEO or your SERP.
     
    jonathandey, Jan 18, 2010 IP
  5. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Hmm. I had also heard about .htaccess file. Do you know how to redirect URL from that file ? and how to implement it.
     
    B.Williams, Jan 18, 2010 IP
  6. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    I see try using this piece of code
    
    Options +FollowSymLinks
    RewriteEngine on
    # index.php to /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    
    Code (markup):
    Place this in to the .htaccess file and place the .htaccess file in your root directory (where index.html is)
     
    jonathandey, Jan 18, 2010 IP
  7. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Thats all ? I dont need to do any thing else? Only paste this code in .htaccess file and my work done? Then my URL will not show index.html? are you sure?
     
    B.Williams, Jan 18, 2010 IP
  8. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #8
    Yes it should do just change the .php to .html and it should work :D
     
    jonathandey, Jan 18, 2010 IP
  9. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #9
    Hey man i hv upload the file. But getting this error..

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
     
    B.Williams, Jan 18, 2010 IP
  10. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #10
    jonathandey, Jan 18, 2010 IP
  11. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You may have missed this:

    So what's in there? It's always a plus to review what you copy and paste.

    This is what worked for me:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{THE_REQUEST} \/index.html\ HTTP [NC]
    RewriteRule (.*)index.html$ /$1 [R=301,L]
     
    theapparatus, Jan 18, 2010 IP
  12. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #12
    Hey Thanks man its worked for me.. Thank You once again to you both..

    One more thing its not showing index.html when i go in homepage but in Links when i hover my mouse it shows my old link with index.html.. How to remove it from their also :)
     
    B.Williams, Jan 18, 2010 IP
  13. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #13
    You mean hover over the links or what exactly? Now sure what you;re asking here. A link may be helpful.
     
    theapparatus, Jan 18, 2010 IP
  14. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #14
    Yes, I mean when i hover my mouse on Home button it shows me domain.com/index.html rather then domain.com.. But when i click and go to my homepage it simple shows domain.com. not shows index.html. I want same thing when hover mouse. I hope now u got it :)
     
    B.Williams, Jan 18, 2010 IP
  15. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #15
    I think you can add a title tag to it e.g.
    
    <a href="index.html" title="http://www.domain.com">Home</a>
    
    Code (markup):
     
    Last edited: Jan 18, 2010
    jonathandey, Jan 18, 2010 IP
  16. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #16
    Its not about Home button only. I have almost 3 to 4 keywords which are using domain.com/index.html. I want all of those keywords to show only domain.com rather than domain.com/index.html
     
    B.Williams, Jan 18, 2010 IP
  17. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #17
    This should still solve the problem for all of them :D
     
    jonathandey, Jan 18, 2010 IP
  18. jonathandey

    jonathandey Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #18
    No problem glad it could help!
     
    jonathandey, Jan 19, 2010 IP
  19. B.Williams

    B.Williams Active Member

    Messages:
    555
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #19
    Hey man your code work for PHP. Can you please tell me how to hide extensions of all internal pages also? (.html extension) ?
     
    B.Williams, Jan 19, 2010 IP
  20. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #20
    If you want to link to the index.html page without specifically stating <a href="index.html">Link</a> you can use the following code:

    <a href="/">Link to Homepage</a>.

    You'll have to go through and change these links manually on your site, or use Dreamweaver's (or your web editors) search function to find any <a href="index.html" and replace with <a href="/"
     
    pmek, Jan 20, 2010 IP