htaccess的下载文件,而不是装

编程入门 行业动态 更新时间:2024-10-24 22:27:37
本文介绍了htaccess的下载文件,而不是装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我真的很喜欢我的index.html才能够对它有一个PHP脚本的工作。我看,你可以通过htaccess文件做到这一点。我只能访问一个子网站的目录,在那里我可以通过FTP上传我的文件。

I would really like my index.html to be able to have a PHP script work on it. I read that you can do this through the htaccess file. I only have access to a subdomain website directory, where I can upload my files through FTP.

目录不具有一个htaccess文件,所以我创建了一个使用记事本:htaccess的,并已将此添加到文件:

The directory did not have a htaccess file, so I created one using notepad: .htaccess and added this to the file:

AddType application/x-httpd-php .html

现在的问题是,而不是装载index.html页面,它下载它作为一个文件...我需要一些额外添加到htaccess文件? :•

The problem is, instead of loading the index.html page, it downloads it as a file...would I need to add something extra to the htaccess file? :S

推荐答案

您不必将文件命名为 index.html的有它服务在默认情况下。您可以使用同一个条目修改默认文档的的.htaccess 文件是这样的:

You don't need to name the file index.html to have it served by default. You can change the default document using your with an entry in your .htaccess file like this:

DirectoryIndex index.php

然后,当你浏览到 yoursubdomain.example 您奉上的index.php 而不是 index.html的。

如果真的想为PHP除preT你的.html文件,那么你在你的问题时,PHP运行作为Apache模块将工作过的条目。如果你的主机正在运行PHP作为CGI,你想要的:

If really do want PHP to interpret your .html documents then the entry you had in your question will work when PHP is running as an Apache module. If your host is running PHP as CGI, you want:

AddHandler application/x-httpd-php .html

如果它仍然无法正常工作,那么这个网页有一些建议:

If it still doesn't work, then this web page has some more suggestions:

  • 的www.velvetblues/web-development-blog/how-to-parse-html-files-as-php/

更多推荐

htaccess的下载文件,而不是装

本文发布于:2023-11-01 23:22:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   文件   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!