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

前端 未结 16 1459
忘了有多久
忘了有多久 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:44

    Create a .htaccess file at the root of your website and add this line:

    [Apache2 @ Ubuntu/Debian: use this directive]

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

    Or, from comment below:

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

    If your are running PHP as CGI (probably not the case), you should write instead:

    AddHandler application/x-httpd-php .html .htm 
    

提交回复
热议问题