简体   繁体   中英

Process all html pages as php in windows hosting modifying web.config file

I inserted PHP code in all my 350 .html pages. It is impossible for me to change all extensions to .php I need to process all .html pages like .php

I found instructions to do it in .htaccess file but my hosting is Windows. I can only modify web.config file, I don't have access to IIS Manager or other resources.

The code I found for .htaccess is:

AddType application/x-httpd-php5 .html .htm

But I need it for web.config file.

Thank you.

first backup your files

create a new php file in folder contain the files you want to change add this code to file

<?php
    foreach (glob("*.html") as $filename) {
        list($name, $ext) = explode('.', $filename);
        rename($filename, $name.'.php');
    }
?>

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