简体   繁体   中英

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 :)

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.

i believe

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

should work for your needs (untested)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM