开发者

How do I rewrite .php to .html using .htaccess rules?

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜