简体   繁体   English

Symfony 3在根目录提供静态html文件

[英]Symfony 3 serve static html file at root

I made a few months ago a symfony website for a client. 几个月前,我为客户建立了一个symfony网站。

Today he asks me to add a simple static html file to the root of the website, that contains nothing but a hash. 今天,他要求我向网站的根目录添加一个简单的静态html文件,该文件只包含一个哈希。 (This file will be used by a community manager to register the website somewhere). (社区管理员将使用此文件在某个地方注册网站)。

Then I asked myself, what is the simplest way to tell Symfony to serve this static html file just as simple apache would do, by just placing it to the root folder ? 然后我问自己,告诉Symfony将简单的apache放置到根文件夹中的最简单方法是像简单的apache一样来提供此静态html文件?

To be clear, this file must be accessed at the root level, just as an index file. 为了清楚起见,必须在根级别访问该文件,就像索引文件一样。 What makes it not convenient is that its name is a hash itself. 不方便的是它的名称本身就是哈希。

如果您使用的是apache和默认的.htaccess文件,则如果文件存在于public / web目录中,则将直接提供该文件。

您的apache / nginx配置是什么样的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在symfony和apache中提供静态文件 - Serve static files in symfony and apache 如何将 PHP 中 Web 根目录之外的文件中的视频提供给 html5 视频源 - How to serve a video from a file outside the web root in PHP to a html5 video source 如何通过Symfony应用程序为Angular SPA提供index.html文件? - How to serve index.html file for an Angular SPA from a Symfony application? Symfony2提供打开的pdf文件 - Symfony2 serve open pdf file 如何在 PHP 脚本执行旁边使用 Caddy 提供 static 文件? (交响乐) - How to serve static files with Caddy next to PHP Script execution? (Symfony) 使用Sinatra / Rack(在MiddlemanApp中)将PHP文件作为静态文本/ html提供吗? - Use Sinatra/Rack (in MiddlemanApp) to serve PHP files as static text/html? 如何将 Laravel 视图转换为静态 HTML 并从缓存中提供它们? - How to convert Laravel views to static HTML and serve them from cache? 有没有办法在 Firebase 主机上将 a.php 文件作为 html 提供服务? - Is there a way to serve a .php file as html on Firebase hosting? .htaccess规则可从静态文件中提供“ bla.php?id = 1” - .htaccess rules to serve “bla.php?id=1” from static file 将 symfony 从根目录移动到 public_html - move symfony from root directory to public_html
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM