How to redirect from home.php to home ?

Discussion in 'Apache' started by xantoniox, Jun 9, 2012.

  1. #1
    This is my code in the .htaccess:

    Options -Multiviews
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^home$ home.php [L]
    Code (markup):
    With this code the url www.example.com/home does work but it doesn't redirect from www.example.com/home.php to www.example.com/home

    With this code instead:

    Options -Multiviews
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^home$ home.php [R=301,L]
    Code (markup):
    I get this error:

    Not Found
    
    The requested URL /var/chroot/home/content/08/236108/html/home.php was not found on this server.
    
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    How can I redirect from home.php to home and avoid errors ?
    Code (markup):

     
    xantoniox, Jun 9, 2012 IP
  2. xradar

    xradar Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Maybe try this one:

     
    xradar, Jun 12, 2012 IP
  3. gregBS

    gregBS Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you want to redirect FROM home.php TO home you should change the order of RewriteRule parameters like this:


    RewriteRule ^home.php$ home [L]
     
    gregBS, Jun 12, 2012 IP