Using .htaccess to make all .html pages to run as .php files?

前端 未结 16 1478
忘了有多久
忘了有多久 2020-11-22 00:41

I need to run all of my .html files as .php files and I don\'t have time to change all of the links before our presentation tomorrow. Is there any way to \"hack\" this with

16条回答
  •  一生所求
    2020-11-22 01:19

    This is in edition to all other right answers:

    If you are not able to find the correct Handler, Simply create a .php file with the following contents:

    
    

    and run/open this file in browser.

    Use this output in .htaccess file

    Create a .htaccess file at the root of your website(usually a folder named public_html or htdocs on linux servers) and add this line:

    AddType [[THE OUTPUT FROM ABOVE FILE]] .html .htm
    

    Example

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

    Important Note:

    If you see blank page or Notice: Undefined index: REDIRECT_HANDLER

    Try default in .htaccess

    AddHandler application/x-httpd-php .html
    

提交回复
热议问题