I want to convert .php
extension to .html
extension using .htaccess
rules
Is this something I can do, and if so开发者_Python百科, how?
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]
Uses mod_rewrite. $1 indicates first part of the regex and [nc] means not case sensitive.
You can take a look at this article: http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html
EDIT: Removed a line. You do not need that I think. Also, commented on what I did.
Maybe try
RewriteCond %{REQUEST_FILENAME} =-f
RewriteRule ^(.*)\.php$ $1.html [NC,L]
RewriteRule ^(.*)\.html$ $1.php [NC,L]
精彩评论