GT22
GT22

Reputation: 503

using .htaccess to rename .php files .html?

just wondering if there will be any problems renaming .php files .html files via .htaccess? Our existing site is html and I want to update the pages with dynamic php pages, but people have links saved to the existing html site. If this isn't possible, is my only way to create html pages with iframes to wrap the php pages in?

thanks :)

Upvotes: 0

Views: 5043

Answers (2)

xdazz
xdazz

Reputation: 160863

It is not renaming the php file to html, but just redirect the file use html extension to php files.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f        # don't apply to the existing html files
RewriteRule ^([^.]+)\.html$ /$1\.php [QSA,L]  # QSA means combine query string.

Upvotes: 3

Sam Janssens
Sam Janssens

Reputation: 1491

i believe

RewriteEngine on
RewriteRule ^(.*)\.html $1\.php

should work for your needs (untested)

Upvotes: 2

Related Questions