Redirecting .html to .php

Discussion in 'Apache' started by login, Apr 22, 2007.

  1. #1
    I have a few html pages that I want to redirect one by one to php pages. What would be the correct line in .htaccess ?

    .htaccess file in the folder "bil" with the line Redirect 301 index.html http://www.mydomain.info/bil/index.php is not working

    Thanks.

    EDIT: Ok. RewriteEngine on

    Redirect 301 /bil/index.html works
     
    login, Apr 22, 2007 IP
    inworx likes this.
  2. Juan Pablo Olivera

    Juan Pablo Olivera Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I would recommend that you do that only for indexes and for the rest you can just modify the code. For indexes you can do it from httpd.conf, look for something like this:

    
    DirectoryIndex index.html index.wml index.cgi  index.php index.phtml index.htm
    
    Code (markup):
    and make sure index.php is before index.html. Save changes & restart apache.

    Good luck :)
     
    Juan Pablo Olivera, May 8, 2007 IP
    inworx likes this.
  3. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. Was looking for this info.

    :)
     
    inworx, May 10, 2007 IP
  4. Juan Pablo Olivera

    Juan Pablo Olivera Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You are welcome :D
     
    Juan Pablo Olivera, May 10, 2007 IP
  5. Range

    Range Banned

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #5
    Thanks to this info,
    this info usefull for me too :)
     
    Range, May 13, 2007 IP
  6. Juan Pablo Olivera

    Juan Pablo Olivera Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You are welcome too ;)
     
    Juan Pablo Olivera, May 14, 2007 IP
  7. palconit

    palconit Peon

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    about restarting apache. does it apply when my hosting is GoDaddy? thanks.
     
    palconit, May 14, 2007 IP
  8. Juan Pablo Olivera

    Juan Pablo Olivera Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you have a dedicated server or VPS then yes, login via SSH as root and issue the command:

    /etc/init.d/httpd restart

    If you are a shared hosting customer and you need to restart apache for some reason you should contact your provider.
     
    Juan Pablo Olivera, May 23, 2007 IP