htaccess rewrite .php -> html having 404 issue

Discussion in 'Apache' started by stefanosc, Mar 4, 2011.

  1. #1
    Hello

    I am transitioning many static html pages on a small website to php.
    To maintain page rank and incoming links I thought of using htaccess rewrite so that all new page.php could still be accessed via the old links page.html

    I am not very experienced with htaccess and I did some research on this forum and other forums. I tested various syntax, including:

    • RewriteRule ^(.*)\.html$ $1.php [R=301,L]
    • RewriteRule ^(.*)\.html$ $1.php [L]
    • RewriteRule ^([^.]+)\.html$ $1.php [L]

    The last one seemed to work fine, but pages that are not .php (native .html pages) now return a 404.

    Could anyone help with this?
    Any suggestion would be very much appreciated

    Thank you!!
     
    stefanosc, Mar 4, 2011 IP