redirecting website.com to website.com/index.php

Discussion in 'Apache' started by MarcL, Feb 23, 2011.

  1. #1
    How would I redirect website.com to website.com/index.php?
     
    MarcL, Feb 23, 2011 IP
  2. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Do you have index.html and index.php files in the "root" folder ? Just search after DirectoryIndex directive in your apache configuration and put index.php in front of index.html (in Debian is in modules folder in mod_dir.conf). Or use RedirectPermanent


    (You can add it in your .htaccess file)

    Regards
     
    sacx13, Feb 24, 2011 IP
  3. MarcL

    MarcL Notable Member

    Messages:
    4,265
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    215
    #3
    That puts it into a redirection error loop where .index.php is in the url like 100 times.... I need it because saleage.com/ is a blank web.php from another htaccess rewrite I have, so I need to make sure if / then go to index.php
     
    MarcL, Feb 24, 2011 IP
  4. clau

    clau Guest

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I am not very sure what do you want to do but you might want to try adding

    DirectoryIndex index.php
    Code (markup):
    to the .htaccess file.
     
    clau, Feb 24, 2011 IP
  5. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Then just use DirectoryIndex.

    Regards
     
    sacx13, Feb 24, 2011 IP
  6. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yes this is much better than using a header redirect to do this
     
    srisen2, Mar 2, 2011 IP
  7. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #7
    RewriteRule ^/*$ index.php [R=301,L]
    Code (markup):
     
    joebert, Mar 5, 2011 IP
  8. mergemedia

    mergemedia Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Add this to your .htaccess file.

    DirectoryIndex index.php
    Code (markup):
     
    mergemedia, Mar 16, 2011 IP