Forum Moderators: phranque
I am updating my old site and all the pages are done in PHP. All the pages display .php as well as the file extension. I would like the new extension to be .html instead of .php. Is there a way I can create a .htaccess rewrite rule that will show .php pages for .html but when a user types in .php it will redirect to .html?
The reason why is the .php have all the pagerank but I am now using .html.
I hope I explained that well. :)
Thanks in advance for your help!
# Redirect direct client requests for <anything>.php to <anything>.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*[^.]+)\.php[^\ ]*\ HTTP/
RewriteRule \.php$ http://www.example.com/%1.html [R=301,L]
#
# Serve requests for .html URLs from same-named .php files
RewriteRule ^([^.]+)\.html$ /$1.php [L]
Jim
[edited by: jdMorgan at 2:12 pm (utc) on Oct. 20, 2006]
Do I have to change .html to .php? [webmasterworld.com]
Edit: Nevermind, I got that backwards.
I do have a question though.
Why do you need .html extension when the php pages are doing fine in the SEs?
[edited by: Birdman at 2:23 pm (utc) on Oct. 20, 2006]