How do i remove /index.php from url?

Discussion in 'Apache' started by sejunction, Aug 22, 2006.

  1. #1
    sejunction, Aug 22, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
    RewriteRule ^index\.php$ http://www.site.com [R=301,L] 
    Code (markup):
     
    mad4, Aug 22, 2006 IP
    ResaleBroker likes this.
  3. sejunction

    sejunction Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    mad4, tried your code, but getting an infinite loop... not working
     
    sejunction, Aug 22, 2006 IP
  4. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Probably your browser cache, try another browser or restart firefox.
     
    mad4, Aug 22, 2006 IP
  5. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Make sure that that none of the links within your site point to "/index.php" - always use "/" instad. Then you won't need to worry about it.
     
    Cryogenius, Aug 22, 2006 IP
  6. talentcoder

    talentcoder Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    edit the httpd.conf, and add index.php in line:
    DirectoryIndex index.html index.php
     
    talentcoder, Aug 23, 2006 IP
  7. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #7
    
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php$ / [R=301,L]
    RewriteRule ^(.+)\.html$ /$1.php [R=301,L]
    
    Code (markup):
    That should work.
     
    smatts9, Aug 23, 2006 IP